[tz] New IANA-timezone support date/time library

Jon Skeet skeet at pobox.com
Tue Feb 23 08:11:22 UTC 2021


My Noda Time <https://nodatime.org> library for .NET supports this as well.

See https://nodatime.org/3.0.x/userguide/tzdb for more details, including a
source code example.

Finally, java.time supports this too to some extent via ZoneRulesProvider
<https://docs.oracle.com/javase/10/docs/api/java/time/zone/ZoneRulesProvider.html>,
although there's a significant gap in terms of a public implementation that
allows you to load data from a file or directory. (I suspect that sort of
flexible implementation is present, but not public.) There may be third
party implementations.

Jon


On Mon, 22 Feb 2021 at 18:12, Brian Park via tz <tz at iana.org> wrote:

> Thanks for the info. I scanned through the Readme page, but I couldn't
> find the answer to my question: Does your library have the ability to set
> the underlying database to a specific TZDB version (e.g. 2019f, 2021a)?
>
> I would like this feature to get deterministic functional testing, instead
> of having the OS change the underlying TZDB version underneath me. The
> HowardHinnant C++ date library (https://github.com/HowardHinnant/date) is
> the only library that I know that has this feature. I am looking for a
> second library.
>
>
> On Mon, Feb 22, 2021 at 9:32 AM Kerry Shetline via tz <tz at iana.org> wrote:
>
>> I’ve just finished an extensive update of a JavaScript/TypeScript
>> date/time library that I’d previously used only for my own astronomy
>> website, skyviewcafe.com. I’ve done enough updates to this library now
>> that it may be of interest to many other software developers, especially if
>> they want to handle the odd edge cases that exist in timezone handling,
>> like 47-hour days and missing days and the like. One unique features is
>> that it's possible for users to get live updates of the tz database, which
>> usually don’t become available to applications without, at the very least,
>> restarting an application, if not rebooting one’s computer.
>>
>> Libraries in this category are hardly unique, but one of the most popular
>> libraries, Moment.js, is being phased out, so this seemed to be to be a
>> good time to introduce a new one.
>>
>> Among the (possible) unique features, you can do things like find the
>> specific moments of DST transitions and other transitions, like UTC offset
>> changes, and get descriptions of these changes, like this:
>>
>> new DateTime('2021-11-07',
>> 'America/New_York').getDiscontinuityDuringDay() →
>> { start: '02:00:00', end: '01:00:00', delta: -3600000 } // fall back!
>>
>> // As soon as it’s midnight on the 30th, it’s instantly midnight on the
>> 31st, erasing 24 hours:<br>
>> new DateTime('2011-12-30', 'Pacific/Apia').getDiscontinuityDuringDay()) →
>> { start: '00:00:00', end: '24:00:00', delta: 86400000 }
>>
>> // As soon as it’s midnight on the 31th, turn back to 1AM on the 30th,
>> adding 23 hours to the day:<br>
>> new DateTime('1969-09-30',
>> 'Pacific/Kwajalein').getDiscontinuityDuringDay() →
>> { start: '24:00:00', end: '01:00:00', delta: -82800000 }
>>
>> My updated library can be found here:
>> https://www.npmjs.com/package/@tubular/time
>>
>> Besides the IANA timezone support, this library also features the ability
>> to handle variable switch-over from the Julian to the Gregorian calendar,
>> which can be of helpful to those handling historical dates.
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mm.icann.org/pipermail/tz/attachments/20210223/1eb20b03/attachment.html>


More information about the tz mailing list