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

Kerry Shetline kshetline at gmail.com
Fri Feb 19 20:14:35 UTC 2021

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 <http://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 <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/20210219/b808a7ac/attachment.html>

More information about the tz mailing list