Best Moment.JS Alternatives

Comparing size, performance, Typescript support and more

Jakub Kozak
The Startup

--

Moment.js is indeed done

It has been a popular library for parsing, validating, manipulating, and formatting dates for a decade. However, Moment.js has too many drawbacks compared to modern date and time libraries. Its API is not immutable, it is large and it doesn’t support tree shaking. Even the Moment team discourages to use their library in new projects.

“We now generally consider Moment to be a legacy project in maintenance mode. It is not dead, but it is indeed done.” — The Moment team

Modern alternatives

There are multiple solid date and time libraries for JavaScript you can use instead. We’ll look into Luxon, Day.js, date-fns and js-joda.

The following comparison includes attributes that should help you choose the right one for your project.

GitHub stars

NPM packages using the libraries

Public GitHub repositories using the libraries

Immutability

TypeScript support

Performance

--

--

Jakub Kozak
The Startup

👨‍💻 Senior Frontend Engineer 🟢 Support me by becoming a Medium member: https://bit.ly/3VPCuqA ☕ Or let's grab a coffee: https://ko-fi.com/jakubkozak