Skip to content

Core Rules

  • The core functions, which every industry uses.

GMT enforces a strict input/output contract to keep behavior predictable and auditable. These four rules are the non-negotiables.

RuleCurrent behavior
String-first APIPublic helpers consume ISO strings and return normalized strings where appropriate
Temporal-only internalsTemporal does the parsing and timezone math
Plain/zoned separationplain/* is timezone-free, zoned/* is timezone-aware
No-throw public helpersInvalid input returns a typed fallback instead of throwing

Invalid input fallbacks are consistent across the library:

Helper returnsSentinel on invalid input
string""
numbernull
booleanfalse
array[]

The rules above follow from four deliberate choices:

  • Explicit inputs only. Public APIs accept clearly defined shapes — ISO 8601 date/time strings, IANA timezone identifiers, or Unix epochs as safe integers or digit strings, in seconds or milliseconds ({ epochUnit }). We do not attempt to parse arbitrary or ambiguous date formats.
  • Predictable outputs. Helpers return normalized values (ISO strings, numbers, booleans, or arrays). Invalid input yields typed fallbacks ("", null, false or []) instead of throwing.
  • No fuzzy parsing. Avoid “throw everything at the wall” patterns found in permissive libraries. If you need permissive parsing, perform it outside @northguild/gmt and then canonicalize to the strict shapes before calling into gmt.
  • Developer comfort with standards. The library’s goal is to make developers comfortable and deliberate with ISO 8601, IANA timezones, UTC instants, and Unix epochs by keeping APIs small and explicit.
Accessibility
© 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.