Moment.js
Do not use for new projects. Use Luxon as the default replacement. date-fns is an alternative when only a few utility functions are needed. The native Temporal API is an option for projects targeting modern browsers only (~69% global coverage as of May 2026); use @js-temporal/polyfill everywhere else.
What is itโ
Moment.js is a JavaScript date/time library for parsing, validating, manipulating, and formatting dates. It was the standard date library for nearly a decade (2011โ2020).
Why it's deprecatedโ
- Self-declared legacy project โ the Moment team says "We now generally consider Moment to be a legacy project in maintenance mode. It is not dead, but it is indeed done."
- Massive bundle size โ doesn't support tree-shaking; adds ~70 KB min+gzip (with locales potentially 230 KB+).
- Mutable API โ Moment objects are mutable, a common source of bugs.
- Native Temporal API is landing โ full support in Chrome 144+, Edge 144+, Firefox 139+ (~69% global coverage as of May 2026).
- Superior alternatives exist โ Luxon (immutable, built-in time zones and i18n, 21 kB), date-fns (modular, tree-shakable), Day.js.
Recommended replacementโ
Luxon โ the default replacement. Immutable API, built-in time zone and i18n support, and a clean migration path from Moment. date-fns is a lighter alternative when only a few utility functions are needed. The native Temporal API is available in Chrome 144+, Edge 144+, and Firefox 139+ but still lacks Safari support; it is appropriate only for B2B apps with controlled browsers.
Migration pathโ
- Replace
moment()calls with Luxon'sDateTimeโ see the Luxon migration guide for Moment users - Replace
moment.duration()withDurationandmoment.rangepatterns withInterval - Replace
moment-timezoneusage โ Luxon handles IANA time zones natively - Alternative: date-fns โ replace
moment()calls with date-fns functions (format,addDays,differenceInDays, etc.) if only simple utilities are needed - Alternative: Temporal โ use
Temporal.PlainDate,Temporal.ZonedDateTime, etc. Use@js-temporal/polyfillfor environments without native support - Audit all
moment()usage โ codemods exist (e.g.,moment-to-dayjs-codemod) - Remove
momentandmoment-timezonefrom dependencies
Resourcesโ
- Moment.js Project Status
- Luxon โ recommended replacement
- Luxon migration guide for Moment users
- date-fns
- MDN Temporal