x12TimeCodeZone
Signature
Section titled “Signature”x12TimeCodeZone(timeCode: X12ZoneTimeCode): X12NamedZone | nullRead the zone an X12 time code (data element 623) names.
-
Data element 623 is the code beside the date (element 373) and time (element 337) of an X12
AT7,G62orDTMsegment. 25 of its 56 codes name a zone and state no offset; this function reads those. Codes are release 008010, read from Stedi’s X12-licensed dictionary; the X12 text itself was not reached. ### Time codes that name a zoneCodes The dictionary’s definition zoneAD,AS,AT“Alaska Daylight Time”, “Alaska Standard Time”, “Alaska Time” AlaskaCD,CS,CT“Central Daylight Time”, “Central Standard Time”, “Central Time” CentralED,ES,ET“Eastern Daylight Time”, “Eastern Standard Time”, “Eastern Time” EasternHD,HS,HT“Hawaii-Aleutian Daylight Time”, “Hawaii-Aleutian Standard Time”, “Hawaii-Aleutian Time” Hawaii-AleutianMD,MS,MT“Mountain Daylight Time”, “Mountain Standard Time”, “Mountain Time” MountainND,NS,NT“Newfoundland Daylight Time”, “Newfoundland Standard Time”, “Newfoundland Time” NewfoundlandPD,PS,PT“Pacific Daylight Time”, “Pacific Standard Time”, “Pacific Time” PacificTD,TS,TT“Atlantic Daylight Time”, “Atlantic Standard Time”, “Atlantic Time” AtlanticLT“Local Time” Local -
The result is a zone name, not an offset. X12 states no offset for these codes and GMT holds no registry of places, so the caller maps the name to an IANA zone. A caller might choose
America/New_YorkforEastern; the choice is the caller’s. Resolve the local date-time in that zone withresolveLocal. -
daylightistruefor aDcode,falsefor anScode andnullfor aTcode, which says neither: the date decides. Both members are always present. -
LTis local to the event and returns{ zone: "Local", daylight: null }. The place is elsewhere in the message, so the caller supplies its zone. -
An offset code returns
null:01–29,UTandGMstate an offset and name no zone. Read one withx12TimeCodeOffset. -
TS,TT,CDandMDare codes of data element 1250 too, with unrelated meanings: here they are Atlantic Standard, Atlantic, Central Daylight and Mountain Daylight Time; thereTSis the formatHHMMSS. Pass a time code here and a format qualifier to theparseX12…functions. -
For a code that arrives as a string, call
classifyX12TimeCodefirst: its"zone"result carries the code narrowed to this function’s parameter. -
Matching is exact: two characters, upper case, no padding. Each call returns a new object. Returns
nullfor a code that is not one of the 56 and for a non-string.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
timeCode | X12ZoneTimeCode | X12 data element 623 time code (e.g. “ES”) |
Returns
Section titled “Returns”{ zone, daylight }, or null on invalid input
X12NamedZone
Section titled “X12NamedZone”The zone an X12 data element 623 time code names: the result of x12TimeCodeZone. X12 states no offset for a named code, so the result carries none.
import type { X12NamedZone } from "@northguild/gmt";| Member | Type | Description |
|---|---|---|
zone | string | X12’s own name for the zone, as its definition writes it: Alaska, Central, Eastern, Hawaii-Aleutian, Mountain, Newfoundland, Pacific or Atlantic, and Local for LT. It is a name, not an IANA identifier and not an offset: the caller maps it to a zone. |
daylight | boolean | null | Whether the code says daylight time. true for a D code (ED), false for an S code (ES), and null for a code that says neither (ET, LT), where the date decides. |
Related types
Section titled “Related types”Examples
Section titled “Examples”import { x12TimeCodeZone } from "@northguild/gmt/intermodal/parse";
x12TimeCodeZone("ES") // { zone: "Eastern", daylight: false }