Docs
Installation
Install mmntjs and choose the right entry point: mmntjs (full compat, 179.5KB raw bundled), mmntjs/lite (recommended, 55.2KB raw bundled), or mmntjs/fns (tree-shakeable standalone helpers).
Guidance
Getting Started vs Installation
Getting Started helps you choose a strategy and entry point for your specific migration scenario. Installation is the mechanical reference: the exact commands and import paths to use once you have decided.
If you are unsure where to start, read Getting Started first to decide whether mmntjs/lite (recommended) or the default mmntjs entry fits your codebase.
Prefer Lite By Default
mmntjs/lite (55.2KB raw bundled) is the recommended entry for most teams. Install it first, then only switch to the default mmntjs (179.5KB raw bundled) if your codebase needs full-compat features like moment.utc(), moment.parseZone(), duration helpers, or locale-rich format tokens without plugin imports.
- Start every new module or browser entry point with
mmntjs/lite. - Use the alias-based install for the lowest-friction trial.
- Switch to the default
mmntjsentry only when lite's surface is insufficient.
Examples
Lite — direct install (recommended)
npm install mmntjs
# then import as:
import moment from "mmntjs/lite";Start here. mmntjs/lite is 55.2KB raw bundled / 14.8KB gzip bundled, moment-compatible, and covers common formatting, manipulation, and comparison needs.
Lite — alias trial
npm install moment@npm:mmntjs/liteZero-code trial: keep existing import moment from "moment" intact while evaluating lite.
Lite with add-ons
import moment from "mmntjs/lite";
import "mmntjs/plugin/format-parse";
import "mmntjs/locale-auto/ja";Add parsing, locale, or UTC features explicitly when your module needs them.
Default entry — full compat (when lite is not enough)
npm install mmntjs
# then import as:
import moment from "mmntjs";Use the default entry (179.5KB raw bundled / 45.1KB gzip bundled) when your codebase depends on full-compat features like moment.utc(), moment.parseZone(), or duration helpers without plugin imports.
Default entry — alias trial
npm install moment@npm:mmntjsAlias-based trial for full-compat evaluation without changing import sites.
Migration tool rewrite
npm install mmntjs
mmntjs migrate --apply path/to/moduleAuto-rewrite imports. The tool detects which APIs your code uses and suggests the best entry point (lite or full).
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.