# Why GMT?

Industry: Core

`@northguild/gmt` is not the latest entry in a crowded field — it is a
fundamentally different bet about what a date/time library should guarantee.
The sections below make that concrete with data drawn from the library itself.

- **78,184** tests in one run
- **2,345,520** test runs in CI on every pull request
- **781** public functions
- **10** time zones, from UTC−11 to UTC+13:45
- **17** locales in every test

## The bug is the `Date` object

Almost every date/time bug in a JavaScript codebase traces back to one type. `Date` conflates an instant with a wall-clock reading, parses two ways depending on the string, and mutates in place.

| You write | You get | Why |
| --- | --- | --- |
| `new Date("2025-01-15")` | Tue Jan 14 2025 19:00 GMT−5 | A bare date string is UTC midnight. West of Greenwich that is still the previous evening. Add a time and the rule silently flips to local. |
| `new Date("2025-03-30T01:30")` | 02:30 — no error | 01:30 never happened in London that night — the clocks jumped 01:00 → 02:00. Date invents a nearby valid instant instead of telling you. |
| `new Date(2025, 3, 1)` | April 1, not March 1 | Months are 0-indexed. Days are 1-indexed. In the same constructor call. |
| `Date.UTC(2025, 0, 15, 9, 30)` | a millisecond count, not a date | Year, month, day, hour and minute are bare positional numbers, so a swapped pair still runs. Months count from 0, and a year from 0 to 99 is read as 1900 to 1999. |
| `d.setDate(d.getDate() + 1)` | mutates d in place | A Date handed to a function can be changed underneath you. There is no read-only Date. |
| `"09:00 every Tuesday, Tokyo"` | not representable | A Date is a single integer — milliseconds since the epoch. It cannot hold a wall-clock time or a recurring local time. |
| `same code, two machines` | two different answers | Parsing and formatting use the host timezone. A laptop in Denver and a CI runner in UTC disagree. |
| `wrapper.now() / wrapper(dateString)` | a native Date, renamed | Most Date-wrapping libraries store a real Date as their internal state and default their clock to it. Every fault above is still reachable — only the syntax changed. |
| `DST edge-case coverage` | thin, disabled, or failing | DST transitions are the hardest case for a Date-shaped model to get right. It shows: wrapper libraries' own test suites are consistently the ones most likely to under-test, skip, or fail exactly this case. |
| `how a wrapper checks itself` | against a sibling wrapper, not a spec | With no independent standard to test against, a Date-wrapping library can only grade itself against another one — so a bug shared by the whole family passes every one of their suites. |

## CI test execution volume

The most direct measure of testing rigor is how many times the library is
actually executed in CI. GMT's suite is 78,184 tests, and its 17-locale
matrix is built into those tests rather than layered on top. On every PR, CI
then re-runs the whole suite under 10 timezones and 3 Node
versions, so every test runs 30 times.

**Test executions per library**

One run of each suite, before any CI matrix. GMT: 78,184 tests. Competitors: 386–8,910.

GMT: 78,184 tests, re-run across 10 timezones × 3 Node versions = 2,345,520 executions. Competitors: 386–1,209,794.

The split matters. On suite size alone, GMT's 78,184 tests already
outnumber the largest alternative's (Spacetime, 8,910). The matrix
is what turns that into 2,345,520 executions: about 2× the most-executed
alternative and about 6,076× the least, against a surface area that is itself larger.

## API surface

GMT exposes 781 public functions across 21 namespaces, plus 33
regex patterns in `regex`. 12 namespaces are the core — `plain`, `zoned`, `utc`, `unix`, `precision`, `calendar`, `timescale`, `duration`, `interval`, `instant`, `span`, and `recurrence` — and
9 belong to one industry each: `intermodal`, `transport`, `workforce`, `aviation`, `finance`, `gnss`, `healthcare`, `rail`, and `iot`. All of it is generated
from the same TypeScript source and verified by the same test suite.

**Public functions per namespace**

671 core functions across 12 namespaces, plus 33 regex patterns. Every namespace shares one contract: ISO 8601 strings in, typed values out, no Date object.

110 functions across 9 industry layers; lighter segments are shared layers an industry draws on.

The core is weighted toward `plain` and `zoned`, which hold 377 of its 671 functions.
`plain` has one set of operations for each wall-clock shape — dates, times and date-times —
and `zoned` carries them into a real time zone, where a day is not always 24 hours long.
`utc` and `unix` apply the same rules to UTC strings and epoch numbers.

The industry layers are small on purpose. Each is built on the core, so every layer agrees on
what a midnight, a day or an elapsed hour is. The facts come from the caller: GMT does not
map a port to a time zone or look up a carrier's free days, so it holds no registry that can
go stale. The intermodal layer also reads and writes the timestamp formats freight exchanges:
UN/EDIFACT `DTM`, ANSI X12 dates and time codes, and GS1 EPCIS 2.0 event times. [Read the industry guides →](/gmt/guides/industries/)

## Timezone coverage

GMT tests against 10 timezones chosen not for geographic spread but for offset coverage — from UTC−11 (Pacific/Niue) to UTC+13:45 (Pacific/Chatham). That 24.75-hour window means that at any given moment, at least one zone is already living in tomorrow while another is still stuck in yesterday. Date-boundary bugs — off-by-one day, wrong month rollover, DST gaps — only surface when the suite runs across this full offset range. A test that passes at UTC can fail at UTC+14 simply because the calendar date is different.

$10 timezones spanning $UTC−11 to $UTC+13:45. Hover a dot for the current local time in ISO 8601. Times refresh every second via Temporal.

## Locale matrix

GMT does not test every locale — there are hundreds, and most differ only in formatting minutiae. Instead it tests a curated matrix of 17 locales chosen to stress the dimensions that actually break date libraries: script direction (LTR/RTL Arabic and Hebrew), character sets (CJK, Cyrillic, Latin), pluralization rules, and ICU data variants. The goal is not exhaustive locale coverage — it is representative coverage of every class of bug that locale-aware code can produce.

**Locale matrix by script family — 17 locales across 5 script families. Latin (9), CJK (4), Arabic/Hebrew (2), Cyrillic (1), Turkic (1). Each cell shows the locale code and English name.**

## Correct at the edges

Most date bugs hide at the extremes, where ordinary tests never look. GMT tests them directly:

- **Midnight.** A time at the last nanosecond of the day stays on that day.
- **The ends of time.** The first and last moments a date can represent still give exact answers.
- **Daylight saving.** Days, weeks and months start at the right moment across clock changes, right to the end of the calendar.
- **Zones ahead of UTC.** Sydney and Kiritimati work right up to the last moment that can be represented.
- **Long totals.** Adding up time stays exact to the nanosecond, however large the total.
- **Touching intervals.** A 9–5 meeting and a 5–6 meeting don't overlap: an interval includes its start, not its end.
- **Zero known bugs.** None of the 78,184 tests is skipped or switched off.

[See the evidence behind each of these →](/gmt/guides/concepts/correct-at-the-edges/) · Where the Temporal polyfill gets one of these wrong, GMT returns the spec's answer and reports the defect upstream: [Helping fix Temporal →](/gmt/upstream/)

## What this means

| Dimension             | GMT                                              | Legacy libraries                                                    |
| --------------------- | ------------------------------------------------ | -------------------------------------------------------------------- |
| **CI executions**     | 2,345,520               | 386 – 1,209,794 |
| **Locales tested**    | 17, built into every test        | 0 – 140 files, tested in isolation from the rest of the API surface |
| **Timezones tested**  | 10 × every public function     | 0 – 22 files, tested in isolation; date-fns re-runs its whole suite under 378 time-zone settings |
| **Node versions**     | 22, 24, 26                      | 1 – 5 |
| **Public functions**  | 781                | 84 – 246<sup><a href="#public-api-counts" aria-label="How public functions are counted">*</a></sup> |
| **Time precision**    | Nanoseconds, exact as `bigint`                   | Milliseconds                                     |
| **Sentinel contract** | `""` / `null` / `false` / `[]`                   | Throws `RangeError`                                                   |

<p id="public-api-counts" class="gmt-table-note">
  <sup>*</sup> Public functions and methods, counted from each library's published
  TypeScript declarations: every exported function, plus every public method of its
  exported classes and types. Overloads, aliases and inherited methods count once;
  constructors, getters and properties do not. 
  . GMT exports functions only.
</p>

The table is the point. GMT does not add a few convenience methods to an
existing `Date` wrapper — it replaces the type system entirely with
[TC39 Temporal](https://tc39.es/proposal-temporal/), then rebuilds the
ergonomic surface on top of that guarantee. Every function takes and returns
[ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) strings,
every zoned value carries its
[RFC 9557](https://www.rfc-editor.org/rfc/rfc9557) time-zone annotation, and
the 17-locale, 10-timezone matrix runs
against the library's *entire* public API on every PR, not a sample of it.
That is what 2,345,520 CI executions verify.

The full table, how each figure was measured, and what each library covers are on
[GMT and the other libraries](/gmt/compare/).
