Re: DateTime setting invalid zone.
[email protected] (Dave Rolsky) Wed, 13 Mar 2013 11:10:30 -0500 (CDT)
| Newsgroups | perl.datetime |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 12 Mar 2013, Bill Moseley wrote:
> So, I found some old that wrapped a set_time_zone in an eval.
>
> my $dt = DateTime->new(
> year => 2013,
> month => 3,
> day => 10,
> hour => 2,
> minute => 4,
> time_zone => 'floating',
> );
>
> eval { $dt->set_time_zone( 'America/Los_Angeles' ); };
>
> print "$dt " . $dt->time_zone . "\n";
>
>
> The code was using the eval to check if the timezone set failed, and if it
> did went on to do something else with $dt (like set to UTC). But, it
> seems like even if it fails the time zone gets set. The above returns this
> invalid time:
>
> 2013-03-10T02:04:00
> DateTime::TimeZone::America::Los_Angeles=HASH(0x7fc4c2aafc90)
>
> My question is should DateTime associate that timezone to $dt if the
> set_time_zone call actually throws an exception?
This is almost certainly a bug.
-dave
/*============================================================
http://VegGuide.org http://blog.urth.org
Your guide to all that's veg House Absolute(ly Pointless)
============================================================*/