classifyLocal
Signature
Section titled “Signature”classifyLocal(localDateTime: string, timeZone: string): LocalTimeClassification | nullReport whether a zoneless local wall time is unique, ambiguous or nonexistent in a zone — before any policy resolves it.
- Ambiguous and nonexistent wall times are the single most common datetime bug there is: 01:30 happens twice on a fall-back day and never on a spring-forward one.
resolveLocalwill pick one for you; this exists so a demurrage clock, a medication window or a duty limit can refuse instead, or route the case to a human, rather than silently accepting whichever instant a default handed it. - Reads the zone’s own transition table via
Temporal, so it is right for every IANA zone and every year, including 30- and 45-minute shifts and zones that skipped a whole calendar day changing sides of the date line. localDateTimeis a PlainDateTime string, asisValidDateTimeaccepts:<date>T<time>with no offset and no annotation of any kind (a string with an offset has no ambiguity left to report), sotimeZonealone is the zone.- Returns null on invalid input — never
"unique", which would read as a verdict. timeZonemay be a UTC offset, including onegetTimeZoneOffsetreturned with seconds. A fixed offset names one instant for every wall time, so the classification is always"unique".
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
localDateTime | string | zoneless ISO 8601 local datetime string (e.g. “2024-11-03T01:30:00”) |
timeZone | string | IANA name or UTC offset the wall time is read in: a time zone identifier (+05:30, +0530, -08) or a stored offset (±HH:MM[:SS], what getTimeZoneOffset returns) |
Returns
Section titled “Returns”“unique” | “ambiguous” | “nonexistent”, or null on invalid input
Related types
Section titled “Related types”Examples
Section titled “Examples”import { classifyLocal } from "@northguild/gmt/instant/convert";
classifyLocal("2024-07-15T12:00:00", "Asia/Tokyo") // "unique"Source
Section titled “Source”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.