Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DateTime-Format-Strptime CPAN distribution.

Report information
The Basics
Id: 16611
Status: rejected
Priority: 0/
Queue: DateTime-Format-Strptime

Owner: Nobody in particular
Requestors: mark [...]

Bug Information
Severity: Important
Broken in: 1.0700
Fixed in: (no value)

Subject: %D mis-handles 4 digits years.
Download (untitled) / with headers
text/plain 490b
Giving a 4 digit year and the %D format, a wrong date will be returned instead of throwing an error. The following test script illustrates this. The date starts out in 2005, but is transformed into the year "2020". use Test::More qw/no_plan/; use strict; use DateTime::Format::Strptime; my $Strp = new DateTime::Format::Strptime( pattern => '%D'); my $dt; eval { $dt = $Strp->parse_datetime('12/15/2005'); }; ok($@,"a 4 digit year with %D should throw an error ") || diag $dt->mdy('/');
Download (untitled) / with headers
text/plain 351b
%D is an alias for %m/%d/%y. %y is a two-digit year and therefore it takes the year in 02/22/2009 as '20'. It then applies some bogus logic to decide that you want the 21st century and so the result is 2020. In other words, this is not a bug. In future, please log bugs in the google-code project:

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to