fix bad minute spec in Session/DateTime/epochToHttp. Add tests to cover

This commit is contained in:
Colin Kuskie 2006-08-09 20:06:19 +00:00
parent aacae49b37
commit b3678c6795
3 changed files with 5 additions and 3 deletions

View file

@ -1,4 +1,5 @@
7.0.6
- fix: Error in DateTime.pm
7.0.5

View file

@ -258,7 +258,7 @@ sub epochToHttp {
my $time_zone = $self->getTimeZone();
my $dt = DateTime->from_epoch(epoch=>$epoch, time_zone=>$time_zone);
$dt->set_time_zone('GMT');
return $dt->strftime('%a, %d %b %Y %H:%m:%S GMT');
return $dt->strftime('%a, %d %b %Y %H:%M:%S GMT');
}
#-------------------------------------------------------------------

View file

@ -15,7 +15,7 @@ use lib "$FindBin::Bin/../lib";
use WebGUI::Test;
use WebGUI::Session;
use Test::More tests => 29; # increment this value for each test you create
use Test::More tests => 30; # increment this value for each test you create
my $session = WebGUI::Test->session;
@ -30,8 +30,9 @@ is($session->datetime->epochToHuman($wgbday,"%y"), "2001", "epochToHuman() - yea
is($session->datetime->epochToHuman($wgbday,"%c"), "August", "epochToHuman() - month name");
is($session->datetime->epochToHuman($wgbday,"%m"), "08", "epochToHuman() - month number, 2 digit");
is($session->datetime->epochToHuman($wgbday,"%M"), "8", "epochToHuman() - month number, variable digit");
is($session->datetime->epochToHuman($wgbday,"%n"), "00", "epochToHuman() - 2 digit minute");
is($session->datetime->epochToHuman($wgbday,"%%%c%d%h"), "%August1608", "epochToHuman()");
is($session->datetime->epochToHttp($wgbday),"Thu, 16 Aug 2001 13:08:00 GMT","epochToHttp()");
is($session->datetime->epochToHttp($wgbday),"Thu, 16 Aug 2001 13:00:00 GMT","epochToHttp()");
is($session->datetime->epochToMail($wgbday),"Thu, 16 Aug 2001 08:00:00 -0500","epochToMail()");
is($session->datetime->epochToSet($wgbday,1), "2001-08-16 08:00:00", "epochToSet()");
is($session->datetime->getDayName(7), "Sunday", "getDayName()");