Subject: | bug in timezone regex |
Date: | Mon, 16 Dec 2013 22:26:02 -0500 |
To: | bug-datetime-format-strptime [...] rt.cpan.org |
From: | David Pyke Le Brun <davidpyke [...] gmail.com> |
hello,
according to
http://en.wikipedia.org/wiki/ISO_8601
"The offset from UTC <http://en.wikipedia.org/wiki/UTC_offset> is given in
the format ±[hh]:[mm], ±[hh][mm], or ±[hh]. ...."
this module only supports the 2nd format.
if you change the regex on line 998 from
$regex =~ s|%z|([+-]\\d{4})|g;
to
$regex =~ s|%z|([+-]\\d\\d:?\\d\\d)|g;
you get the 1st and 2nd formats.
i hope with a little bit more effort, all of the time formats could be
supported.
an alternative would be to offer a way to modify the regex used something
like
my $parser = DateTime::Format::Strptime->new( pattern => '%Y-%m-%dT%T%z',);
$parser->{z} = "([+-]\\d{4})";
thoughts?
David