Ever since British Summer Time ended in the UK last week my application has been seeing a very interesting bug. Here's an isolated Perl script which demonstrates the issue:
#!/usr/bin/perl
use strict; use warnings;
use DateTime::Format::W3CDTF;
use DateTime::Format::ISO8601;
my $tz = 'Europe/London';
sub print_formatted_date {
my $date = shift;
my $tz_date = DateTime::Format::ISO8601->new->parse_datetime( $date );
$tz_date->set_time_zone( $tz );
print "tz_date: $tz_date\n";
$tz_date->set_formatter( DateTime::Format::W3CDTF->new );
print "tz_date with W3C formatter: $tz_date\n";
}
print_formatted_date( '2009-10-25' );
print "\n";
print_formatted_date( '2009-10-26' );
The output of this is:
tz_date: 2009-10-25T00:00:00
tz_date with W3C formatter: 2009-10-25T00:00:00+01:00
tz_date: 2009-10-26T00:00:00
tz_date with W3C formatter: 0
Notice that for dates which fall outside of BST the W3C formatter is rendering them as '0'.
This is an issue for me because a third party library which we use is using DateTime::Format::W3CDTF to format paramters during a SOAP call. Because the formatting is failing the calls are failing.
Anyone have any clues? I'm no Perl guru so any help would be really appreciated. Could this be a bug in the DateTime::Format::W3CDTF library?