3 ms·
Show HN: Tzintl.js – International Date-Time Conversion
- timemachine 5y agoThanks for sharing. Date math is my kryptonite.
- jer0me 5y agoPronounced tinsel?
- masswerk 5y agoThis is an interesting question. If it enjoys some success, I'll come up with a creative pronunciation… ;-) Tinsel is certainly nice!
- KarlKemp 5y agoJust 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.
- noodlesUK 5y agoWhat’s the comparison with the well known JS/TS date time libraries such as date-fns or the older moment.js?
- masswerk 5y agoThe 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.)
- davidcollantes 5y agoVery well done, and useful! Thank you for building this, and releasing it for everyone to use.
- Svetlitski 5y agoIt’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 https://tc39.es/proposal-temporal/docs/index.html
- krono 5y agohttps://caniuse.com/temporal https://caniuse.com/temporal Browser with the first green block wins a cookie, go!
- FrontAid 5y agoThis issue currently blocks shipping Temporal support without a flag: https://github.com/tc39/proposal-temporal/issues/1450 https://github.com/tc39/proposal-temporal/issues/1450
- masswerk 5y agoUpdate: 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")`.)