mmntjs
Compatibility-first migration bridge away from moment.js

Docs

Runtime Support

Summarize supported runtimes and where runtime-specific behavior deserves extra testing.

Guidance

Support Matrix Before Rollout

Teams usually want to know runtime boundaries before they spend migration time. Node, Bun, browser, and module-format expectations should be easy to scan here.

  • Node.js 16+ is the baseline runtime target.
  • CJS and ESM entry points are both published.
  • Browsers, Bun, and Deno should be evaluated as supported consumption environments, but your own bundling and timezone assumptions still need verification.

Separate API Availability From Deployment Confidence

A package can load in a runtime and still need environment-specific verification before production rollout. Date libraries are especially sensitive to local timezone behavior, locale data expectations, and bundler entry-point resolution.

That means the right question is not only 'does it import?' but also 'does it behave the same way here as it did in the runtime we are replacing?'.

  • Run at least one non-UTC test pass when your application depends on local time.
  • Check how your runtime resolves CJS vs ESM entry points before large-scale import rewrites.
  • Treat timezone-data usage as a separate capability review from core UTC and fixed-offset behavior.

What To Verify Per Environment

The highest-value runtime checks are usually small and concrete. In Node, verify the same module system shape you ship today. In browser builds, verify bundle size and locale loading. In Bun or Deno, verify the import path and a few representative compatibility-sensitive tests rather than relying on a smoke import alone.

  • Node: import style, test runner behavior, timezone-sensitive assertions.
  • Browser: bundle output, tree-shaking, script-tag or ESM consumption path.
  • Bun and Deno: package resolution, test parity, and any runtime-specific Intl or timezone assumptions.

Examples

Node.js ESM

import moment from "mmntjs";

moment.utc("2024-06-15T12:30:00Z").format();

Use this shape when your application already runs on ESM entry points in Node, Bun, or bundler-managed server code.

Node.js CommonJS

const moment = require("mmntjs");

moment("2024-01-01").add(1, "day").format("YYYY-MM-DD");

Useful for confirming compatibility in older service code that still loads moment-style dependencies via CommonJS.

Browser script tag

<script src="https://cdn.jsdelivr.net/npm/mmntjs/dist/mmntjs.min.js"></script>
<script>
  mmntjs.utc("2024-06-15T12:30:00Z").format();
</script>

This checks the no-bundler path separately from your ESM build pipeline.

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.