develooper Front page | perl.datetime | Postings from July 2017

Re: How to tell (in advance) if a date-time is ambiguous?

Thread Previous | Thread Next
From:
Zefram
Date:
July 12, 2017 12:22
Subject:
Re: How to tell (in advance) if a date-time is ambiguous?
Message ID:
20170712122213.GD15923@fysh.org
Binarus wrote:
>So is there any change to add an according API function to DT:TZ?

Yes, but we wouldn't want to rush it.  There's more than one
implementation of the API, and we want to be sure to design it correctly
the first time.

Perhaps it could be a ->offsets_for_local_datetime method (note
plural in the name), which returns a sorted list of all the timezone
offsets that are applicable to a specified local time.  Normally the
list would have length 1, the element being the same value returned by
->offset_for_local_datetime.  Ambiguous local times (regardless of the
source of ambiguity) yield more than one offset.  Non-existent local times
(skipped due to clocks going forward) yield an empty list without error.

-zefram

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About