Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Tzintl.js – International Date-Time Conversion (masswerk.at)
56 points by masswerk on Dec 28, 2021 | hide | past | favorite | 11 comments



It’ll be nice when TC39 finalizes Temporal [1] and it has been implemented in most major browsers, replacing Date and obviating libraries like this.

[1] https://tc39.es/proposal-temporal/docs/index.html


This issue currently blocks shipping Temporal support without a flag:

https://github.com/tc39/proposal-temporal/issues/1450


https://caniuse.com/temporal

Browser with the first green block wins a cookie, go!


Update: Version 1.1 now also supports time zone aliases (both TZIntl and TZProvider). – You should see some more time zones in the demo widget.

(Aliases are now included in any test and there's also an option to include aliases in `TZProvider.enumerate(<boolean: all>)`, which still defaults to unique time zones like `Intl.supportedValuesOf("timeZone")`.)


Thanks for sharing. Date math is my kryptonite.


What’s the comparison with the well known JS/TS date time libraries such as date-fns or the older moment.js?


The focus is just on converting dates, there's no idea of formatting dates (other than a simple, localized ISO string, which may be useful to some for further parsing). It returns an object with numeric properties, letting you decide on what to do with it and what the actual format should be.

Since it relies on the Intl implementation of the browser (which is supported by all modern browser, but only partly by later versions of MSIE), it's light-weight (ca 1.3 KB minified and gzipped) and should be up to date regarding day light saving time, etc., without any further maintenance required. (On the other hand, as you rely on a user's browser and the OS – as in the demo widget –, it is not recommended for mission critical tasks, like in banking. But this should be rather obvious to those designing such applications.)


Very well done, and useful! Thank you for building this, and releasing it for everyone to use.


Pronounced tinsel?


This is an interesting question. If it enjoys some success, I'll come up with a creative pronunciation… ;-) Tinsel is certainly nice!


Just put a line in the README that it’s “pronounced with a hard G, like noon”, then wait to see what the MC at the first conference uses when they introduce you.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: