3 ms·
https://date-fns.org/ https://date-fns.org/ is the most popular alternative to moment-js, has an intuitive functional API and treats dates as immutable. I migra
by kcorbitt 6y ago
https://date-fns.org/ https://date-fns.org/ is the most popular alternative to moment-js, has an intuitive functional API and treats dates as immutable. I migrate every project I touch over to it since it has so many fewer footguns.
- eropple 6y agoHuh - thanks for the link. The Moment folks also have Luxon, which I've been using, but there's quite a lot more momentum behind date-fns.
- Drdrdrq 6y agoOr give day.js a try. It is basically moment.js without its problems, and pretty popular too. I tried date-fns but found it cumbersome to use... Ymmv.
- erichurkman 6y ago+1 for date-fns. It's not uncommon to look at a downloads in a JavaScript bundle to find out Moment — and its timezone and localization files — are a huge percentage of a download for a single `moment.format()` call.
- pyrhho 6y agoI wanted to use date-fns on the current project. But, the gotcha is due to its lack of timezone support many of its functions are inherently broken (e.g. startOfWeek). So, if you need rich calculations with timezone support watch out!