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