
Moment.js
A JavaScript library for parsing, validating, manipulating and formatting dates; now in maintenance mode.moment/moment
- Stars
- 47.9k
- Forks
- 7k
- Licence
- MIT
- Language
- JavaScript
- Last update
- 29 days ago
- Type
- Library
What it is
Moment.js is a JavaScript library that helps programs work with dates and times: reading date strings, checking whether they are valid, changing them (adding days, shifting time zones, and so on), and displaying them in readable formats. It is installed into a JavaScript project with npm, yarn, or bun. The README now marks it as a legacy project in maintenance mode, so it is not accepting new features.
- Parse a date string written in a known format and check whether it is valid
- Add or subtract days, weeks, or months from a date
- Format a date into a human-readable string for display on a web page
Great for
- Maintaining existing JavaScript projects that already depend on Moment.js
- Developers who need a familiar date API and are not starting a new project
- Teams whose code already uses Moment and need bug-level upkeep
Not ideal for
- New projects: the README says new features are not being accepted, so newer date libraries may be a better long-term choice
- Users who need a tool with no programming involved, since this is a code library
How to get it
- 1
Install with a package manager
You'll need: Node.js (version not specified in the README)
Install Moment.js with npm
npm install moment - 2
Run it
- Run npm install moment in your project folder.
- Import or require moment in your JavaScript file.
- Call moment() to get the current date, or pass it a date string to parse.
- Use methods such as format() to display the result.
- 3
Get the most out of it
- Read the official documentation at momentjs.com/docs for the full API
- Check the project's CHANGELOG.md for version-specific changes
- Review SECURITY.md and THREAT_MODEL.md before using it with untrusted input
Downloads
Strengths
- Widely used, with a large community and many years of existing code and examples
- MIT licensed and distributed through npm
- Maintained under the OpenJS Foundation, which provides governance and a security policy
Trade-offs
- Maintenance mode: no new features are being accepted, so the library will not gain modern capabilities
- The README does not detail its size or performance trade-offs, so check those for your use case
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| moment (this) | 47.9k | Library | beginner | 29 days ago | Maintaining existing JavaScript projects that already depend on Moment.js |
| dayjs | 48.7k | Library | beginner | 2 months ago | JavaScript developers who used Moment.js and want a smaller library |
| luxon | 16.5k | Library | beginner | 3 months ago | JavaScript developers who need to work with dates and time zones in an app |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.