[TZInfo-users] local_to_utc failure

Philip Ross phil.ross at gmail.com
Tue Jan 29 05:22:21 EST 2008


On 29/01/2008, Danny Burkes <dburkes at infoteria.com> wrote:
> Sorry- I put the previous code sample in terms of Rails'
> tzinfo_timezone plugin.  Here is some "raw" tzinfo code that
> illustrates the bug:
>
> irb(main):004:0>  tz = TZInfo::Timezone.get('America/Argentina/
> Buenos_Aires')
> => #<TZInfo::DataTimezone: America/Argentina/Buenos_Aires>
> irb(main):005:0> tz.local_to_utc(DateTime.new(2007,12,30,0,30,0))
> TZInfo::PeriodNotFound: TZInfo::PeriodNotFound
>
> If I use tzinfo 0.3.5, all is well-
>
> irb(main):004:0> tz = TZInfo::Timezone.get('America/Argentina/
> Buenos_Aires')
> => #<TZInfo::DataTimezone: America/Argentina/Buenos_Aires>
> irb(main):005:0> tz.local_to_utc(DateTime.new(2007,12,30,0,30,0))
> => #<DateTime: 117814303/48,0,2299161>
> irb(main):006:0>

Hi Danny,

This is a valid change between 0.3.5 and 0.3.6. Version 0.3.6 upgraded
the version of the tz data to 2007k which included a change to the
Argentina daylight savings rules (see
http://article.gmane.org/gmane.comp.time.tz/2013).

Argentina adopted daylight savings again at midnight local time on 30
December 2007. At midnight, the time moved forward an hour. Therefore,
the local times between midnight and 1am did not actually exist.
TZInfo raises the PeriodNotFound exception to indicate this condition.

Regards,

Phil

--
Phil Ross
http://tzinfo.rubyforge.org/ -- DST-aware timezone library for Ruby


More information about the TZInfo-users mailing list