Best Moment.JS Alternatives

Comparing size, performance, Typescript support and more

Jakub Kozak
Oct 4, 2020 · 4 min read

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 immutable, it is large and it doesn’t support tree shaking. Even the Moment team discourages to use their library in new projects.

Modern alternatives

There are multiple solid date and time libraries for JavaScript you can use instead. We’ll look into , , and .

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

GitHub stars

GitHub stars

NPM packages using the libraries

NPM packages

Public GitHub repositories using the libraries

Public GitHub repositories



TypeScript support

TypeScript support


The following charts show one common operation from each type of date and time manipulation. Each operation in the chart was run 100 000 times.

Types of date and time manipulation

  • Parsing
  • Formatting
  • Transformation — a
  • Difference
  • Comparing

From the chart above, you can see that there’s no library that is best for all the operations. Another significant result shows that even 100 000 runs take less than 3 seconds. If you don’t need to process some big data, you shouldn’t be worried about performance of the libraries.


Each size measurement includes the library, its companion library for time zone support if there’s one and polyfills. The polyfills are required for libraries that use for locales, time zones, or both.

Code examples

The entire source code:


Luxon service


Day.js service


date-fns service


js-joda service

How to migrate from Moment.js

  1. Create a date-time service that hides what library you’re using. If you decide to replace the library in the future, you’ll need to update only one file.
  2. Create extensive unit tests for the service.
  3. Use to find all instances of Moment in your codebase and replace them using your new service.
  4. Uninstall moment.js


I hope the comparison answered your questions about the modern date and time libraries that can replace Moment.js.

Let me and other developers know which library you’ve chosen in the comments. Did you consider any other libraries or additional attributes when choosing the right library?

You can find the entire code examples and performance testing in my GitHub repo:

You may like

The Startup

Get smarter at building your thing. Join The Startup’s +799K followers.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store