[TZInfo-users] DST start/stop times?

Philip Ross phil.ross at gmail.com
Sun Oct 9 11:18:15 EDT 2011


Hi Eric,

On 5 October 2011 16:11, Eric Schwartz <eschwartz at comverge.com> wrote:
> Thanks; that was exactly what I needed. In my Copious Free Time(tm), I would be inclined to wrap that up into a method along these lines
>
> def TZInfo::Timezone#period_for_dst(year=Time.now.year)
>  # stuff
> end
>
> if that's a patch you might be interested in. No worries if not; I can understand wanting to keep such a widely-used library lean.

Yes, it seems like something along these lines would be useful, so I'd
be interested in a patch if you can find the time.

I think methods that returned an array of TimezonePeriod objects
between two dates (one method for UTC and another for local time)
would be more generally useful than just returning the periods in a
year:

def TZInfo::Timezone#periods_between_utc(utc_from, utc_to)
  # stuff
end

def TZInfo::Timezone#periods_between_local(local_from, local_to, dst =
Timezone.default_dst)
  # stuff
end

The from and to parameters will have to accept Time, DateTime and
Numeric parameters (see TZInfo::TimeOrDateTime). The local time
version of the method will have to resolve ambiguous local times (see
TZInfo::Timezone#period_for_local).

Kind regards,

Phil


More information about the TZInfo-users mailing list