Subject: | set_time_zone retains time zone even if invalid local time and exception thrown |
From Mailing list on March 13, 2013.
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' );
} || warn "Eval failed with '$@'\n";
print "$dt " . $dt->time_zone . "\n";
Eval failed with 'Invalid local time for date in time zone: America/Los_Angeles
'
2013-03-10T02:04:00 DateTime::TimeZone::America::Los_Angeles=HASH(0x7f9f81ab02a0)
The time zone should not have been associated with the DateTIme object.