Subject: | Strange default day value for incomplete dates |
Date: | Wed, 29 Jun 2011 12:33:59 -0400 |
To: | bug-Date-Manip [...] rt.cpan.org |
From: | Steve Muskiewicz <smuskiew [...] gmail.com> |
It seems like in the update to Date::Manip version 6, something has changed
with regard to the default day of the month for incomplete dates. Apologies
if I missed something in the documentation that may have already explained
this behavior but since seems a little strange I'm wondering if it might
actually be a bug?
It seems as if for incomplete dates like "March 1999" or "April 2005",
Date::Manip is using the century portion of the year to form the day of the
month rather than the expected 1 value (which is how Date::Manip version 5
seems to work).
Here's a sample script (run with both Date::Manip version 5 and 6 to
illustrate, hoping the Perl version itself isn't too relevant to the issue):
First the system (Fedora 14) with Date::Manip 6.24
$ perl -v
This is perl 5, version 12, subversion 3 (v5.12.3) built for
i386-linux-thread-multi
$ perl -e 'use Date::Manip; print "Date::Manip version
$Date::Manip::VERSION\n";'
Date::Manip version 6.24
$ perl -e 'use Date::Manip; $dstr = shift; $date = ParseDate($dstr); $fmt =
UnixDate($date,"%Y-%m-%d"); print "$dstr = $date ($fmt)\n";' "March 1999"
March 1999 = 1999031900:00:00 (1999-03-19)
$ perl -e 'use Date::Manip; $dstr = shift; $date = ParseDate($dstr); $fmt =
UnixDate($date,"%Y-%m-%d"); print "$dstr = $date ($fmt)\n";' "April 2005"
April 2005 = 2005042000:00:00 (2005-04-20)
Now the system (Fedora 12) with Date::Manip 5.54
$ perl -v
This is perl, v5.10.0 built for x86_64-linux-thread-multi
$ perl -e 'use Date::Manip; print "Date::Manip version =
$Date::Manip::VERSION\n"'
Date::Manip version = 5.54
$ perl -e 'use Date::Manip; $dstr = shift; $date = ParseDate($dstr); $fmt =
UnixDate($date,"%Y-%m-%d"); print "$dstr = $date ($fmt)\n";' "March 1999"
March 1999 = 1999030100:00:00 (1999-03-01)
$ perl -e 'use Date::Manip; $dstr = shift; $date = ParseDate($dstr); $fmt =
UnixDate($date,"%Y-%m-%d"); print "$dstr = $date ($fmt)\n";' "April 2005"
April 2005 = 2005040100:00:00 (2005-04-01)
Please let me know if there's anything else I can test or other details you
might need.
And THANKS for an extremely useful module!
regards,
-steve