Skip to content

x12TimeCodeZone

  • Container free time, demurrage, billing deadlines, bill of lading dates and EDI timestamps.
x12TimeCodeZone(timeCode: X12ZoneTimeCode): X12NamedZone | null

Read 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, G62 or DTM segment. 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 zone

    CodesThe dictionary’s definitionzone
    AD, AS, AT“Alaska Daylight Time”, “Alaska Standard Time”, “Alaska Time”Alaska
    CD, CS, CT“Central Daylight Time”, “Central Standard Time”, “Central Time”Central
    ED, ES, ET“Eastern Daylight Time”, “Eastern Standard Time”, “Eastern Time”Eastern
    HD, HS, HT“Hawaii-Aleutian Daylight Time”, “Hawaii-Aleutian Standard Time”, “Hawaii-Aleutian Time”Hawaii-Aleutian
    MD, MS, MT“Mountain Daylight Time”, “Mountain Standard Time”, “Mountain Time”Mountain
    ND, NS, NT“Newfoundland Daylight Time”, “Newfoundland Standard Time”, “Newfoundland Time”Newfoundland
    PD, PS, PT“Pacific Daylight Time”, “Pacific Standard Time”, “Pacific Time”Pacific
    TD, TS, TT“Atlantic Daylight Time”, “Atlantic Standard Time”, “Atlantic Time”Atlantic
    LT“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_York for Eastern; the choice is the caller’s. Resolve the local date-time in that zone with resolveLocal.

  • daylight is true for a D code, false for an S code and null for a T code, which says neither: the date decides. Both members are always present.

  • LT is 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, UT and GM state an offset and name no zone. Read one with x12TimeCodeOffset.

  • TS, TT, CD and MD are codes of data element 1250 too, with unrelated meanings: here they are Atlantic Standard, Atlantic, Central Daylight and Mountain Daylight Time; there TS is the format HHMMSS. Pass a time code here and a format qualifier to the parseX12… functions.

  • For a code that arrives as a string, call classifyX12TimeCode first: 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 null for a code that is not one of the 56 and for a non-string.

ParameterTypeDescription
timeCodeX12ZoneTimeCodeX12 data element 623 time code (e.g. “ES”)

{ zone, daylight }, or null on invalid input

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";
MemberTypeDescription
zonestringX12’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.
daylightboolean | nullWhether 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.
import { x12TimeCodeZone } from "@northguild/gmt/intermodal/parse";
x12TimeCodeZone("ES") // { zone: "Eastern", daylight: false }
output 

intermodal/parse/x12TimeCodeZone.ts