Moment.js

Widely-used but now legacy JavaScript date/time library. Parses, validates, manipulates, and displays dates and times. Was the standard for JavaScript date handling for over a decade. Now in maintenance mode — the Moment.js team officially recommends migrating to modern alternatives (date-fns, Luxon, Temporal API). Still found in millions of codebases due to its historical prevalence. Largest problems: mutable API (mutates dates in place), large bundle size (~300KB), no tree-shaking.

Evaluated Mar 07, 2026 (0d ago) v2.x (legacy)
Homepage ↗ Repo ↗ Developer Tools date time parsing formatting javascript legacy deprecated
⚙ Agent Friendliness
68
/ 100
Can an agent use this?
🔒 Security
97
/ 100
Is it safe for agents?
⚡ Reliability
91
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
88
Error Messages
80
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
100
Auth Strength
100
Scope Granularity
100
Dep. Hygiene
80
Secret Handling
100

Pure utility library — no network, no secrets. Maintenance mode means security patches may be slow. ReDoS vulnerability history — use updated version.

⚡ Reliability

Uptime/SLA
90
Version Stability
95
Breaking Changes
90
Error Recovery
88
AF Security Reliability

Best When

You're maintaining an existing codebase that already uses Moment.js and migration cost is not justified.

Avoid When

Starting any new project — use date-fns, Luxon, or the native Temporal API instead. Moment.js is in legacy maintenance mode.

Use Cases

  • Maintain existing codebases that already use Moment.js — changing would require significant refactoring
  • Parse and format dates in legacy Node.js applications where bundle size is not a concern
  • Use moment-timezone for timezone-aware date operations in existing Moment.js projects
  • Relative time formatting ('2 hours ago', 'in 3 days') which was Moment.js's killer feature
  • Date arithmetic (add/subtract days/months/years) in server-side Node.js where bundle size is irrelevant

Not For

  • New projects — use date-fns (functional, tree-shakeable) or Luxon (immutable, Intl-based) for new code
  • Frontend/browser apps where bundle size matters — Moment.js adds ~300KB; use date-fns or Temporal
  • TypeScript-heavy projects — Moment.js TypeScript support is incomplete compared to modern alternatives

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

No authentication — date utility library.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Fully free, MIT licensed. In maintenance mode.

Agent Metadata

Pagination
none
Idempotent
Partial
Retry Guidance
Not documented

Known Gotchas

  • Moment.js is in maintenance mode — new projects should use date-fns or Luxon; Moment.js team recommends against using it for new code
  • Moment objects are mutable — moment().add(1, 'day') modifies the original object; always clone with .clone() before storing references: const m = original.clone().add(1, 'day')
  • Bundle size is ~300KB — if used in browser bundles, consider lazy loading or migrating to date-fns which is tree-shakeable
  • Parsing without explicit format is lenient and may parse unexpected strings — always provide explicit format string: moment('2024-01-15', 'YYYY-MM-DD')
  • Month indices are 0-based (January = 0) for moment().month() but month() setter uses same 0-based — inconsistency with day-of-month which is 1-based
  • moment-timezone adds significant bundle size on top of base moment — use Luxon (built on Intl.DateTimeFormat) for timezone handling in new code

Alternatives

Full Evaluation Report

Comprehensive deep-dive: security analysis, reliability audit, agent experience review, cost modeling, competitive positioning, and improvement roadmap for Moment.js.

AI-powered analysis · PDF + markdown · Delivered within 30 minutes

$99

Package Brief

Quick verdict, integration guide, cost projections, gotchas with workarounds, and alternatives comparison.

Delivered within 10 minutes

$3

Score Monitoring

Get alerted when this package's AF, security, or reliability scores change significantly. Stay ahead of regressions.

Continuous monitoring

$3/mo

Scores are editorial opinions as of 2026-03-07.

6470
Packages Evaluated
26150
Need Evaluation
173
Need Re-evaluation
Community Powered