mmntjs
Compatibility-first migration bridge away from moment.js

Docs

Timezone and parseZone

Clarify what core UTC and fixed-offset behavior is covered and what requires separate timezone support.

Guidance

Timezone Expectations Need Plain Language

The site should clearly separate core UTC and fixed-offset behavior from full timezone-data expectations. Most costly migration mistakes happen when teams assume these are the same concern.

  • Verify parseZone and keepLocalTime with real examples.
  • Run tests in at least one non-UTC timezone.
  • Document any dependence on external timezone data explicitly.

Timezone Package (mmntjs-timezone)

mmntjs-timezone provides IANA timezone data and APIs as a separate package. It is compatible with moment-timezone: moment.tz(), moment.tz.guess(), zone()/zoneName(), and .tz() instance methods all work once the package is loaded.

Core mmntjs covers only UTC and fixed-offset behavior; install the timezone package when your application depends on named zones like America/New_York or Asia/Tokyo.

The raw timezone data is packed into about 293 KB of generated source using base-60 encoding, delta frequency dictionaries, and permutation-group index codecs. The distributed bundle is about 318.3 KB raw and 39.0 KB gzip.

  • Install: npm install mmntjs-timezone (about 39.0 KB gzip as dist output, 81.1 KB gzip in a bundled browser entry).
  • Import import "mmntjs-timezone" to attach timezone APIs to the moment factory.
  • The timezone data is pre-packed; first access triggers a one-time lazy unpack.

Examples

Timezone package install

npm install mmntjs-timezone

About 39.0 KB gzip as dist output, or about 81.1 KB gzip in a bundled browser entry. Installs alongside mmntjs core.

Timezone package import

import moment from "mmntjs";
import "mmntjs-timezone";

moment.tz("2024-01-01", "America/New_York").format();

Compatible with moment-timezone: tz(), zone(), tz.guess(), and instance .tz() all work. Raw data is about 293 KB in generated source; dist output is about 39.0 KB gzip.

Core UTC and fixed-offset (no timezone package needed)

import moment from "mmntjs";

moment.utc("2024-01-01T00:00:00Z").format();
moment.parseZone("2024-01-01T09:00:00+09:00").utcOffset();

For UTC and fixed-offset behavior, the timezone package is not required. Install it only when you need named IANA zone data.

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.