atoomic / perl-TimeDate

time & date parsing and formatting perl library
http://search.cpan.org/dist/TimeDate/
1 stars 4 forks source link

Date::Parse bug [rt.cpan.org #57800] #3

Open atoomic opened 4 years ago

atoomic commented 4 years ago

Migrated from rt.cpan.org#57800 (status was 'new')

Requestors:

From ts862m@att.com on 2010-05-24 16:57:37 :

Found a date that str2time() in TimeDate-1.20 > Date::Parse is not
parsing correctly (but that strptime() does parse correctly).  Output,
code, and environment below:

$ bad.pl

str2time:
Day too big - 32993 > 24854
Sec too small - 32993 < 74752
str2time returned undef upon failure to parse '5/1/1960'

strptime:
strptime returned ',,,1,4,60,' from parsing '5/1/1960'

$ cat bad.pl
#!/usr/bin/perl
use Date::Parse;
$date = "5/1/1960";
print "\nstr2time:\n";
$val = str2time($date);
if (!defined($val)) { print STDERR "str2time returned undef upon failure
to parse '$date'\n"; }

print "\nstrptime:\n";
@parts = strptime($date);
if ($#parts < 0) { print STDERR "strptime returned empty array upon
failure to parse '$date'\n"; }
else {
  ($ss,$mm,$hh,$day,$month,$year,$zone) = @parts;
  print "strptime returned '$ss,$mm,$hh,$day,$month,$year,$zone' from
parsing '$date'\n";
}

$ /usr/bin/perl -v

This is perl, v5.8.8 built for i386-linux-thread-multi

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to
the
Internet, point your browser at http://www.perl.org/, the Perl Home
Page.

$ uname -a
Linux mtndbic01 2.6.18-128.el5 #1 SMP Wed Dec 17 11:42:39 EST 2008 i686
i686 i386 GNU/Linux
mtndbic01:/home/ts862m/bin>