Skip Menu |

This queue is for tickets about the Date-Manip CPAN distribution.

Report information
The Basics
Id: 29655
Status: resolved
Priority: 0/
Queue: Date-Manip

People
Owner: Nobody in particular
Requestors: williams [...] tni.com
Cc:
AdminCc:

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



Subject: Date_ConvTZ bugs
Date_ConvTZ does not work as advertised, and is not tested at all. From Date_ConvTZ section: "Both timezones MUST be in one of the formats listed below in the section TIMEZONES." From TIMEZONES section: "The following timezone names are currently understood (and can be used in parsing dates). These are zones defined in RFC 822. Universal: GMT, UT US zones : EST, EDT, CST, CDT, MST, MDT, PST, PDT Military : A to Z (except J) Other : +HHMM or -HHMM ISO 8601 : +HH:MM, +HH, -HH:MM, -HH" In fact, the ISO 8601 formats do not work with Date_ConvTZ. Also, the convtz.t file only does a single test on Date_ConvTZ('today') which is broken, because "today" is illegal. As stated in the docs: "This converts a date (which MUST be in the format returned by ParseDate)" I have attached a patch to fix these problems.
Subject: Date_ConvTZ.patch
diff -ru Date-Manip-5.46/Manip.pm Date-Manip-5.46-fixed/Manip.pm --- Date-Manip-5.46/Manip.pm Wed Feb 21 08:14:40 2007 +++ Date-Manip-5.46-fixed/Manip.pm Fri Sep 28 15:31:12 2007 @@ -3448,8 +3448,12 @@ $to=$Zone{"n2o"}{lc($to)} if (exists $Zone{"n2o"}{lc($to)}); + $to =~ s/:// if $to =~ m/^[+-]\d{2}:\d{2}$/; + $to .= '00' if $to =~ m/^[+-]\d{2}$/; $from=$Zone{"n2o"}{lc($from)} if (exists $Zone{"n2o"}{lc($from)}); + $from =~ s/:// if $from =~ m/^[+-]\d{2}:\d{2}$/; + $from .= '00' if $from =~ m/^[+-]\d{2}$/; $gmt=$Zone{"n2o"}{"gmt"}; return $date if ($from !~ /^[+-]\d{4}$/ or $to !~ /^[+-]\d{4}$/); diff -ru Date-Manip-5.46/t/convtz.t Date-Manip-5.46-fixed/t/convtz.t --- Date-Manip-5.46/t/convtz.t Thu Jul 3 08:34:37 2003 +++ Date-Manip-5.46-fixed/t/convtz.t Fri Sep 28 15:31:31 2007 @@ -11,18 +11,42 @@ } else { die "ERROR: cannot find test.pl\n"; } -$ntest=1; +$ntest=6; print "1..$ntest\n" if (! $runtests); &Date_Init(@Date::Manip::TestArgs); $tests =" -today +2007030113:34:34 +0000 +0100 -2 - nil + 2007030114:34:34 + +2007030113:34:34 ++0000 ++01:00 + 2007030114:34:34 + +2007030113:34:34 ++0000 ++01 + 2007030114:34:34 + +2007030113:34:34 ++0000 +-0100 + 2007030112:34:34 + +2007030113:34:34 ++0000 +-02:00 + 2007030111:34:34 + +2007030113:34:34 ++0000 +-03 + 2007030110:34:34 ";
Problem no longer exists in 6.xx (but I've added the tests to the test suite).