← All open source projects

Moment.js

moment/moment

Moment.js is a historically important JavaScript date and time library, now maintained in maintenance mode.

Forks 6,987
Author moment
Language JavaScript
License MIT
Synced 2026-06-10

What it is

Moment.js is one of the most recognizable JavaScript date libraries: parsing, validation, manipulation, and formatting. For a long time it was the default choice for web projects because it covered a painful area where the built-in `Date` object was awkward and error-prone.

The project now has a special status: Moment.js is a legacy project in maintenance mode. The repository remains useful for maintaining older systems and understanding JavaScript ecosystem history, but new projects usually evaluate newer alternatives.

What is inside the repository

Inside are the library, locales, tests, documentation, changelog, and npm package. The main model is a date object with chained operations, localization, and formatting. That convenient model made the project widely adopted.

Classic Moment.js style

This example shows the familiar chain: parse a date, add a period, and print it in a desired format. In new projects, code like this should be compared with Day.js, date-fns, Luxon, or Temporal.

Language: JavaScript
const start = moment("2026-06-10");
const deadline = start.add(14, "days");

console.log(deadline.format("YYYY-MM-DD"));

Where it is useful

Moment.js is useful where a large older codebase already depends on it, with plugins, locales, and established formats. It is also useful to know when reading legacy code: many interfaces, reports, and admin panels still contain moment chains.

Strengths and limits

The advantage of Moment.js is maturity and familiarity. The limits are size, mutable objects, and maintenance-only status. New products should not add it automatically out of habit; the choice should be made consciously around bundle size, time zones, locales, and future support.