-
-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
I'm trying to use DateTime::Format::Strptime to parse some date/times, and I can't seem to get it to parse the date/time for leap seconds (e.g., 2012-06-30T23:59:60UTC). The documentation says it supports up to 60 seconds for leap seconds. Am I doing something wrong here or is this a bug?
Here's my code:
use DateTime;
use DateTime::TimeZone;
use DateTime::Format::Strptime;
my $utc = DateTime::TimeZone->new(name => 'Etc/UTC');
my $ymdhms_parser = DateTime::Format::Strptime->new(pattern => '%F %T',
locale => 'en_US',
time_zone => $utc,
strict => 1,
on_error => 'croak');
print "DateTime $DateTime::VERSION\n";
print "DateTime::LeapSecond $DateTime::LeapSecond::VERSION\n";
print "DateTime::Format::Strptime $DateTime::Format::Strptime::VERSION\n";
my $date = '2012-06-30 23:59:60';
print "date: $date\n";
my $dt = $ymdhms_parser->parse_datetime($date);
print "dt: $dt\n";
print "tz: ",$dt->time_zone,"\n";The output I get is:
DateTime 1.52
DateTime::LeapSecond 1.52
DateTime::Format::Strptime 1.77
date: 2012-06-30 23:59:60
Parsed values did not produce a valid date at /path/to/test.pl line 17.
Metadata
Metadata
Assignees
Labels
No labels