Subject: | Date_ConvTZ doesn't seem to cope with mixed timezone formats correctly |
The Date_ConvTZ function in the new version of Date::Manip doesn't seem
to cope with mixed timezone formats (eg: mixing +nnnn and timezone
abbreviations) when dealing with DST.
The attached script demonstrates the problem. With Date::Manip 6.07,
this outputs:
+0000 => BST
2001012823:05:00
2001082823:05:00
GMT => +0000
2001012823:05:00
2001082900:05:00
GMT => BST
2001012823:05:00
2001082900:05:00
GMT => Europe/London
2001012823:05:00
2001082900:05:00
As you can see, this version of Date::Manip considers +0000 and BST to
always be the same, whereas converting GMT to +0000 adds an hour during
DST. I'd expect it to ALWAYS add an hour from +0000 => BST, and NEVER
add an hour from GMT => +0000. Likewise, GMT => BST should always add an
hour, no matter what the date is.
The timezone abbreviations GMT and BST should always refer to +0000 and
+0100, the definition of these abbreviations is not affected by DST.
On the other hand, GMT => London is to be correct (the definition of
Europe/London should change with DST).
For comparison, Date::Manip 5.54 outputs the following:
+0000 => BST
2001012900:05:00
2001082900:05:00
GMT => +0000
2001012823:05:00
2001082823:05:00
GMT => BST
2001012900:05:00
2001082900:05:00
GMT => Europe/London
2001012823:05:00
2001082823:05:00
Subject: | test.pl |
#!/usr/bin/perl
use Date::Manip;
#Date_Init("SetDate=now,+0000");
Date_Init("TZ=+0000");
print "+0000 => BST\n";
print Date_ConvTZ("2001012823:05:00", "+0000", "BST")."\n";
print Date_ConvTZ("2001082823:05:00", "+0000", "BST")."\n";
print "\nGMT => +0000\n";
print Date_ConvTZ("2001012823:05:00", "GMT", "+0000")."\n";
print Date_ConvTZ("2001082823:05:00", "GMT", "+0000")."\n";
print "\nGMT => BST\n";
print Date_ConvTZ("2001012823:05:00", "GMT", "BST")."\n";
print Date_ConvTZ("2001082823:05:00", "GMT", "BST")."\n";
print "\nGMT => Europe/London\n";
print Date_ConvTZ("2001012823:05:00", "GMT", "Europe/London")."\n";
print Date_ConvTZ("2001082823:05:00", "GMT", "Europe/London")."\n";