4 ms·
Tempo: The easiest way to work with dates in JavaScript
- IggleSniggle 3y agoFor a moment I was skeptical, but after looking at the codebase, it's almost exactly what I would do: wrap Intl.DateTimeFormat with a few small functions that basically just help enforce that the expected type matches the provided type, with just a tiny touch of additional coercion to make the native API a little less surprising. I've been trying to reduce my dependencies in favor of "vanilla" APIs, but it's hard to argue with the minimalist way this is organized around the Date object. Kudos to the creators!
- jpschroeder 3y agoThanks! You’re bang on — the intention is to be a thin layer on the native Intl while exposing some API features that are not easily accessible. My personal favorite is getting the format tokens for various format styles: `formatStr('full', 'en')` then combining those with range('MMMM', 'en'). You can build some pretty neat stuff and is what powers our company’s datepicker: https://formkit.com/inputs/datepicker https://formkit.com/inputs/datepicker