Subject: | Olson timezone handling incorrect |
Date: | Mon, 4 Dec 2006 13:11:38 -0800 |
To: | bug-datetime-format-strptime [...] rt.cpan.org |
From: | "Steve Fink" <sphink [...] gmail.com> |
The date string "2006-11-14-11:22:43America/Los_Angeles" cannot be parsed
with the format '%Y-%m-%d-%H:%M:%S%O' because of the following code in
DateTime::Format::Strptime:
$tz_olson = ucfirst lc $tz_olson;
$tz_olson =~ s|([/_])(\w)|$1\U$2|;
This produces $tz_olson = "America/Los_angeles", which is not a valid
timezone. I believe the correct code would be:
$tz_olson = ucfirst lc $tz_olson;
$tz_olson =~ s|([/_])(\w)|$1\U$2|g;
although it seems to me that you could replace all of that with:
$tz_olson =~ s/(\w+)/\u$1/g;
Not that any of these would work for Mexico/BajaNorte or
Antarctica/DumontDUrville. Perhaps it would be better not to mess with the
capitalization, or at least look up both the original and normalized
versions.