Install
Latest release: v1.24.0
pnpm add @northguild/gmtnpm install @northguild/gmtyarn add @northguild/gmtbun add @northguild/gmtGMT runs in any browser or runtime that parses ECMAScript 2022 and whose Intl.DateTimeFormat accepts IANA time zones. On Node, its engines field asks for >=22.16.0. It ships its own Temporal, so a built-in Temporal is not needed. Temporal in every engine shows the weekly test runs on each engine.
Your first call
Section titled “Your first call”ISO 8601 strings go in and come out. There is no Date object to create first.
import { addDate, addZoned, diffDate, formatDate } from "@northguild/gmt";
addDate("2024-01-31", { months: 1 }); // "2024-02-29"diffDate("2024-01-01", "2024-03-15", "days"); // 74formatDate("2024-03-15", "en-US", { dateStyle: "long" }); // "March 15, 2024"
// A day is a calendar day, even across Berlin's clock change that nightaddZoned("2024-03-30T12:00:00+01:00[Europe/Berlin]", { days: 1 }); // "2024-03-31T12:00:00+02:00[Europe/Berlin]"
// Bad input returns a value, never an exceptionaddDate("2024-02-30", { days: 1 }); // ""diffDate("not a date", "2024-03-15", "days"); // nullCheck for "", null, false or [] where you would otherwise catch an error. The
Core Rules list every fallback.
What you get
Section titled “What you get”Every public function, type and regex is a flat named export of the package root, and
Temporal, Intl and toTemporalInstant are re-exported beside them, from temporal-polyfill
in 1.24.0 and later, and from @js-temporal/polyfill up to 1.23.1. There are no namespace objects to import — a namespace is a subpath:
// Everything is available from the package rootimport { addDate, formatRelativeZoned, getNow, Temporal } from "@northguild/gmt";
// A namespace subpath, if you only want one family of helpersimport { addZoned, getZonedNow } from "@northguild/gmt/zoned";import { addUtc, getUtcNow } from "@northguild/gmt/utc";import { addUnix, getUnixNow } from "@northguild/gmt/unix";
// A module subpath narrows further, to one namespace's moduleimport { addDateTime, diffDate } from "@northguild/gmt/plain/calculate";
// Types come from the `types` subpathimport type { BusinessCalendar } from "@northguild/gmt/types";Every namespace subpath except types also re-exports Temporal, Intl and
toTemporalInstant, so import { Temporal, addZoned } from "@northguild/gmt/zoned" needs no
second import.
Module subpaths (@northguild/gmt/<namespace>/<module>) exist for every namespace except
regex and types, which you import whole. The reference lists each export under its
namespace and module.
There are fourteen namespace subpaths:
| Subpath | What it covers |
|---|---|
calendar | ISO week and ordinal dates, quarter and fiscal periods, zone-aware bucketing, business calendars with holiday sets and roll conventions, and operating hours with open-time SLA arithmetic |
duration | ISO 8601 duration string parsing, validation, arithmetic and totals, and unit objects such as { minutes: 15 } written as a duration string or totalled |
instant | The instant-plus-offset pair, and explicit resolution of zoneless local wall times |
intermodal | Free time, demurrage and detention counted in the terminal’s local days, with the charged dates behind every count; the invoice, dispute and resolution deadline chain, with every window a caller parameter; bill of lading dates on the local calendar of the place each event happened; an end-to-end multimodal ETA; and the UN/EDIFACT, X12 and GS1 EPCIS timestamps freight exchanges |
interval | Half-open [start, end) interval algebra over instants: overlap, intersect, clamp, merge, subtract, split and sum |
plain | Timezone-free helpers |
precision | Nanosecond (bigint) instants, their JSON bridge, storage truncation, and foreign epoch bridges |
regex | Low-level regex building blocks |
span | Elapsed and wall-clock durations between two timestamps, as raw numbers |
transport | Transit legs as exact elapsed time, arrivals rendered where they land, dwell measured in local calendar days, crossings read in the zone that administers them, multi-leg schedules with missed connections flagged, cut-offs counted back from an anchor event, punctuality against a stated tolerance, and the next departure a connection can make |
types | The shared option and unit types |
unix | Unix epoch (seconds or milliseconds) helpers |
utc | UTC instant helpers |
zoned | Timezone-aware helpers |
AI Agent Skills
Section titled “AI Agent Skills”Every @northguild/* package ships TanStack Intent
skill files inside the npm tarball — versioned, task-routed guidance that you can
hand to a coding agent so it works with the right GMT API for each job. A skill
carries the core rules and the common pitfalls, and points the agent to this site
(https://northguild.dev/gmt/llms.txt, plus the .md twin of any page) and
to the JSDoc in the installed package for signatures and examples.
Discover and load them with the Intent CLI:
# 1. One-time setup — writes skill-loading guidance into AGENTS.mdnpx @tanstack/intent@latest install
# 2. Discover all available skills from installed packagesnpx @tanstack/intent@latest list
# 3. Load a specific skill into an agent sessionnpx @tanstack/intent@latest load @northguild/gmt#gmt-basicsThe linter packages (@northguild/gmt-eslint, @northguild/gmt-oxlint,
@northguild/gmt-biome) use the same mechanism. Intent auto-detects your package
manager and generates the correct runner (npx / pnpm dlx / yarn dlx / bunx).
To restrict which skills an agent may load, add an intent.skills allowlist to
your package.json:
{ "intent": { "skills": ["@northguild/gmt#gmt-basics", "@northguild/gmt#gmt-timezone"] }}Consumer-facing skill slugs
Section titled “Consumer-facing skill slugs”| Package | Slug | Task area |
|---|---|---|
@northguild/ | gmt-basics | Current date/time, parse, format, relative time, compare, validate |
@northguild/ | gmt-arithmetic | Add/subtract, diff, durations, interval range math |
@northguild/ | gmt-timezone | Timezone-aware arithmetic, formatting, DST disambiguation |
@northguild/ | gmt-integration | Cache keys, router/query params, foreign epoch bridges, TAI and leap seconds, lint package selection |
The industry skills are layers on top of those four, not part of Core:
| Package | Slug | Task area |
|---|---|---|
@northguild/ | gmt-gnss | GNSS time scales, broadcast and RINEX week numbers, rollover eras |
@northguild/ | gmt-finance | FIX UTCTimestamp values: precision from the digit count, picoseconds, leap seconds |
@northguild/ | gmt-transport | Transit legs, connections, cut-offs, punctuality, departures |
@northguild/ | gmt-intermodal | Free time, demurrage, billing deadlines, bill of lading dates, EDI and EPCIS timestamps |
@northguild/ | gmt-workforce | Hours-of-work rules over a duty log, with the caller’s own limits |
@northguild/ | gmt-healthcare | HL7 v2 date-times, with the sender’s local time kept apart from UTC |
© 2026 NorthGuild · Licences
Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.