I noticed that DateTime::Format::Strptime defaults to returning
DateTimes in the UTC time zone. Eg,
DateTime::Format::Strptime->new(pattern => '%Y%m%d%H%M%S')
->parse_datetime('20041102000000')
->time_zone->name
==> 'UTC'
This is at odds with DateTime, which defaults to floating. This caused
a mysterious inconsistency in my code.
I think it would be right to change this to floating. I also found the
use of the time zone given to the parser object confusing. I think the
following is a clearer documentation of the current code:
--- lib/DateTime/Format/Strptime.pm.orig 2004-11-02 14:56:37.000000000 -0800
+++ lib/DateTime/Format/Strptime.pm 2004-11-02 14:56:40.000000000 -0800
@@ -859,12 +859,13 @@
=item * new( pattern=>$strptime_pattern )
-Creates the format object. You must specify a pattern, you can also
-specify a C<time_zone> and a C<locale>. If you specify a time zone
-then any resulting C<DateTime> object will be in that time zone. If you
-do not specify a C<time_zone> parameter, but there is a time zone in the
-string you pass to C<parse_datetime>, then the resulting C<DateTime> will
-use that time zone.
+Creates the format object. You must specify a pattern, and may also
+specify a C<time_zone> and a C<locale>. If you specify a time zone, it
+will be used as the default time zone if none is found by parsing, and
+the resulting C<DateTime> object will be converted to that time zone. If
+you do not specify a time zone, 'UTC' will be used as the default time
+zone, and the resulting C<DateTime> object will remain in the time zone
+found by parsing.
You can optionally use an on_error parameter. This parameter has three
valid options:
Change 'UTC' to 'floating' if you take my suggestion.
Andrew