mmntjs
Compatibility-first migration bridge away from moment.js

Docs

Getting Started

Choose the lowest-risk way to evaluate mmntjs in an existing moment.js codebase. mmntjs/lite is recommended as the starting entry point for most teams.

Guidance

Start With The Smallest Credible Evaluation

The first goal is not to rewrite date logic. The first goal is to confirm that one owned part of the system can switch without surprising behavior drift.

That usually means choosing one module with clear tests, limited timezone complexity, and an owner who can judge whether the resulting behavior still matches production expectations.

  • Pick one low-risk module or service boundary.
  • Run the existing test suite before adding migration helpers.
  • Review known differences before broadening scope.

What Success Looks Like

A successful first evaluation is boring: imports are replaced, tests still pass, a few targeted date fixtures compare cleanly, and the team gains confidence about where to expand next.

Start With the Lite Entry Point

mmntjs/lite is the recommended entry for most teams. It provides moment-compatible method chaining at 55.2KB raw bundled / 14.8KB gzip bundled and covers the common creation, formatting, add/subtract, diff, and comparison patterns that most codebases rely on.

Only reach for the default mmntjs entry (179.5KB raw bundled / 45.1KB gzip bundled) when your codebase explicitly depends on full-compat features such as moment.utc(), moment.parseZone(), duration helpers, or locale-aware display tokens like MMMM and dddd without loading them as plugins.

Examples

Zero-code alias trial

# recommended: start with lite (55.2KB raw bundled)
npm install moment@npm:mmntjs/lite

# switch to full compat (179.5KB raw bundled) if needed
npm install moment@npm:mmntjs

Start with the lite alias for the smallest evaluation surface, then switch to the default entry if your codebase needs full-compat features.

Coexistence mode

import moment from "moment";

// already migrated file
import moment from "mmntjs";

This lets one codebase move module by module instead of forcing a single cutoff day.

Migration tool rewrite

npm install mmntjs
mmntjs migrate --apply path/to/module

Use this when you want the tool to rewrite one owned surface while keeping the change reviewable.

First evaluation flow

npm test
# then compare one or two representative date fixtures in the chosen module

The important part is reusing the tests you already trust before inventing new migration scaffolding.

How To Use This Doc

Use this page as a migration review aid rather than as a generic tutorial. If the behavior in this area is business-critical, compare it directly against your current moment.js usage and record the outcome before expanding rollout.