Member-only story

Stop using Moment.js for Dates — This is the Better Alternative

Nicky Christensen
JavaScript in Plain English
3 min readFeb 1, 2022

Working with the Date object in JavaScript can be a real hassle! If you’re not using a ready-made date library, you can look forward to spending a lot of hours being frustrated.

Lucky for us developers, there are awesome people doing libraries to make working with dates in JavaScript much easier. One of the popular choices in this category is Moment.js In many years, this has been the go-to library for developers when working with dates. Unfortunately, Moment.js comes with a lot of overhead and drawbacks. Among others, it has a huge bundle size which will slow down your application a lot.

The people behind Moment.js are even advising against using it.

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

Considering using Moment in your project? There may be better modern alternatives.
from https://momentjs.com/

So if you should stop using Moment.js, which library should you then be using you might ask.

There are a lot of alternatives out there to Moment.js.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Published in JavaScript in Plain English

New JavaScript and Web Development content every day. Follow to join our 3.5M+ monthly readers.

Written by Nicky Christensen

Staff Software Engineer@Harness - A danish guy who speaks about frontend, tech & leadership - Follow & connect @ https://www.linkedin.com/in/dknickychristensen/

Responses (1)

Write a response

date-fns has a unpacked size of 6mbs with 5k+ files
momentjs has unpacked size of 4mbs with around 500 files.
how date-fns is less affecting performance than momentjs?

--