moment

Parse, validate, manipulate, and display dates in javascript.

Showing:

Popularity

Downloads/wk

16.1M

GitHub Stars

46K

Maintenance

Last Commit

8mos ago

Contributors

677

Package

Dependencies

0

Size (min+gzip)

73.7KB

License

MIT

Type Definitions

Built-In

Tree-Shakeable

Yes?

Reviews

Average Rating

4.3/5514
Read All Reviews
drewwmercer
Emad-salah
liorgrossman
VasilyShelkov
riginoommen
karolis-sh
shrpande

Top Feedback

69Great Documentation
68Easy to Use
42Performant
35Highly Customizable
19Abandoned
18Responsive Maintainers

Readme

Moment.js

NPM version NPM downloads MIT License Build Status Coverage Status FOSSA Status SemVer compatibility

A JavaScript date library for parsing, validating, manipulating, and formatting dates.

Project Status

Moment.js is a legacy project, now in maintenance mode. In most cases, you should choose a different library.

For more details and recommendations, please see Project Status in the docs.

Thank you.

Resources

License

Moment.js is freely distributable under the terms of the MIT license.

FOSSA Status

Rate & Review

Great Documentation69
Easy to Use68
Performant42
Highly Customizable35
Bleeding Edge6
Responsive Maintainers18
Poor Documentation0
Hard to Use3
Slow17
Buggy1
Abandoned19
Unwelcoming Community1
100
Drew W MercerRaleigh, NC3 Ratings3 Reviews
Full Stack Web Developer & Software Engineer, specializing in design and development of customized sustainable solutions.
August 5, 2020
Easy to Use
Great Documentation
Responsive Maintainers

One area that can be a pain while spinning up a new web application is working with dates and times. moment has always done exactly what I needed when working with displaying and validating dates and times in my JavaScript projects. I originally used moment a few years back on a scheduling application and it was easy to get up and running with a quick script link. Managing different format styles was quick to track down in the reference material. Documentation was easy to follow even at the first introduction. The update to port moment to ES6 was a welcome one, and it was refreshing to see all features carried over with the upgrade. Using moment again on a recent project, it was simple to include in my React application. No fuss to re-learn date and time formatting and the parsing is taken care of for a clean, consistent front-end result. I have not encountered any dependency conflicts so far when using moment, and stability has not been an issue when new versions are published. The MIT license and open source code available on GitHub makes it easy to track upcoming features and known fixes in the pipeline as well.


3
aj3x
achakavarti
spoonertech
Emad Kheir121 Ratings132 Reviews
Full-stack Software Engineer
1 month ago
Easy to Use
Slow
Highly Customizable
Abandoned
Great Documentation
Buggy
Unwelcoming Community

I've been using Moment.js since I started web development, the biggest advantage to using it is its amazing API which is pretty much self-explanatory but it ends there, The list of disadvantages is really huge so I'll try my best to keep it as short as possible: - Mutable instances: A common gotcha with using Moment.js is that you often think that manipulation methods such as ".add" and ".sub" create a new copy of the date instance but that's not right, you end up getting stuck in complex date issues that take hours to solve. - Huge bundle size: Moment.js has a ginormous bundle size due to it cramming everything in a single package that doesn't support tree-shaking so you end up making your app's bundle size significantly larger by installing Moment.js to it. - Abandoned: Moment.js's maintainers have announced that they're abandoning the project for Luxon, which is much more complicated than Moment.js itself - Slow performance: I've been using Moment.js for quite a while on a stock market analytics site, the site used to lag on mobile devices since the site used to map over large arrays (1000+ entries) and process their dates using Moment.js. As soon as I switched it out for an alternative, the app became a lot faster than it ever was! Two alternatives I can recommend are: - Day.js, which is a much more lightweight date processing plugin that has an API that's very similar to Moment.js's - date-fns, which is also very lightweight and extremely fast (I switched to using this after Moment.js was abandoned), it's immutable as well so if you're into functional programming, you'll find this pretty much better than Moment.js in every way


1
MalcolmNT
Lior GrossmanSan Francisco28 Ratings11 Reviews
Founder & CEO of Openbase
9 months ago

I've used moment extensively in the past for creating user-friendly dates for a few web and social apps. It's very powerful and flexible in terms of functionality, and also supports i18n. However, it's monolithic and has a significant footprint, so it has a severe effect on the bundle size, which is not what you want from a date library. If I were to choose a library today, I'd probably go with date-fns or luxon.


0
Vasily ShelkovDorset45 Ratings46 Reviews
9 months ago
Great Documentation
Easy to Use
Slow

It does make developers lives easier when it comes to working with dates and times. It also has been a great example of documentation. It got too large for its boots though and there are now a number of alternatives that meets most of people's needs while are much more optimised in terms of bundle size of what users have to download. The other gotchya is that moment is mutable, meaning you need to be careful when trying to test it since if you change the date, it could have unintended consequences and change the date for a test you didn't mean it to. Overall, consider using other libraries (which you can find in their documentation), this should not be your go to date time library, you should look to use something like Luxon or date-fns which are immutable apis and also are more performant.


3
aj3x
Smiter15
davymacca
Rigin OommenPune61 Ratings72 Reviews
2 months ago

I used moment in many of my web applications. I feel its mature enough. It has a great documentation for the apps. Flexiblity of playing with date and time is really awesome. But with the recent web development standards i see that it recommends some ther libraties with lightweight. As in moment js with entire package it will be nearing to 70-71 KB in app bundle size. It will be great if we give some optimization on the bundle size on app so we can continue using with modern standards Other than large bundle size. It is a perfect tool to manage date and times. AFAIK this project in maintenance mode


3
shrpande
cskumaresan
sajinimarychandy

Tutorials

No tutorials found
Add a tutorial