MIT licensed · v1.1.0

Date and time
without hidden correction.

Strict, immutable utilities for JavaScript and TypeScript. Exact elapsed time stays separate from calendar wall time, ambiguous input rejects by default, and the runtime dependency count stays at zero.

0
runtime dependencies
100%
runtime test coverage
ESM + CJS
with TypeScript declarations

Install it. Keep control.

Parse strict values, resolve a civil time in an IANA zone, then choose exact or calendar arithmetic explicitly.

npm install strictdatetime
example.tsTypeScript
import {
  addCalendarToZonedDateTime,
  createCalendarDuration,
  parsePlainDateTime,
  resolveZonedDateTime,
  toZonedDateTimeString,
} from "strictdatetime";

const meeting = resolveZonedDateTime(
  parsePlainDateTime("2026-03-07T12:00:00.000"),
  "America/New_York",
);

const tomorrow = addCalendarToZonedDateTime(
  meeting,
  createCalendarDuration({
    years: 0, months: 0, weeks: 0, days: 1,
  }),
);

toZonedDateTimeString(tomorrow);
// 2026-03-08T12:00:00.000-04:00[America/New_York]
Strict inputs

Invalid means invalid.

Typed ISO parsers reject ambiguous correction, unknown annotations, and precision the library cannot preserve.

Honest arithmetic

Elapsed time is not wall time.

Exact durations and calendar durations use separate APIs, so daylight-saving transitions cannot hide in a generic add call.

Structural values

Plain data, frozen.

Values are immutable records with explicit validation. No runtime identity, mutable objects, or cross-bundle instanceof traps.

Host-native zones

No bundled timezone database.

IANA behavior comes from the host runtime’s Intl data, keeping the package small while making timezone ownership explicit.

A focused core for the difficult parts.

  • Values Instant, PlainDate, PlainTime, PlainDateTime, ZonedDateTime
  • Parsing Strict ISO and an intentional RFC 9557 subset
  • Zones IANA names and fixed offsets with explicit disambiguation
  • Arithmetic Exact and calendar add, subtract, compare, and difference
  • Intervals Half-open ranges, containment, overlap, intersection, gap, difference, merge, clamp, and unit boundaries
  • Formatting Canonical serialization and locale-aware Intl output
  • Errors Stable DateTimeError codes across ESM and CommonJS

Node.js 22+ · Current Chromium, Firefox, and WebKit · MIT

Make date and time behavior visible in the code.