Subject: | TimeDate-1.16 > Date::Parse |
Date: | Mon, 14 May 2007 14:58:55 -0700 |
To: | bug-TimeDate [...] rt.cpan.org |
From: | Bulldog <bulldogorama [...] gmail.com> |
Bad month range checking.
str2time accepts invalid month dates, e.g. str2time('2/31/2007')
returns '1172880000', but Feb 2007 only has 28 days.
strptime is even worse, accepting invalid month dates up to 99, e.g.
strptime('2/99/2007') returns (undef, undef, undef, 99, 1, 107,
undef).
No documentation of this issue in the perldocs for this module.
======
Distribution name and version: Date::Parse-2.09 on prod system.
Tested with
Date::Parse-2.27 and still had same issue.
Perl version: v5.6.0 built for Linux-2.4c2.3-i686
Operating System vendor and version: Linux 2.4.21-37a13smp #1 SMP Thu
Nov 16 05:41:08 PST 2006 i686 i686 i386 GNU/Linux
Repro:
=== Code ===
require Date::Parse;
print '2/31/2007 => ', Date::Parse::str2time('2/31/2007'), "\n";
print '2/99/2007 => ', join(',', Date::Parse::strptime('2/99/2007')), "\n";
=== End Code ===
Produces the following (warnings omitted):
~~~ Output ~~~
2/31/2007 => 1172880000
2/99/2007 => ,,,99,1,107,
~~~ End Output ~~~
Thanks.
- David