On Thu, 18 Dec 2003, Mike Schilli wrote:

> Hey guys,
>
> while doing some DateTime calculations, I just stumbled across this
> weird error: The following snippet produces "Invalid local time" for the
> "America/Winnipeg" timezone while it works for all others:
>
> use DateTime;
>
> my $dt = DateTime->from_epoch(epoch => 1141289999);
> $dt->set_time_zone("America/Winnipeg");
> $dt->add_duration(DateTime::Duration->new(months => 1));
>
> Any ideas? I'm using the latest DateTime from CPAN, 0.19.

This is documented in DateTime.pm:

=head4 Invalid Local Times

Another problem introduced by Daylight Saving Time is that certain
local times just do not exist.  For example, in the US in 2003, the
transition from standard to saving time occurred on April 6, at the
change to 2:00:00 local time.  The local clock changes from 01:59:59
(standard time) to 03:00:00 (saving time).  This means that there is
no 02:00:00 through 02:59:59 on April 6!

Attempting to create an invalid time currently causes a fatal error.
This may change in future version of this module.



-dave

/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/

Reply via email to