Skip to content

isValidX12TimeCode

  • Container free time, demurrage, billing deadlines, bill of lading dates and EDI timestamps.
isValidX12TimeCode(timeCode: unknown): timeCode is X12TimeCode

Return true when timeCode is one of the 56 X12 data element 623 time codes, the codes x12TimeCodeOffset and x12TimeCodeZone read between them.

  • The codes are 01–29, GM, UT, LT and the named zone codes (AD, AS, AT, CD, CS, CT, ED, ES, ET, HD, HS, HT, MD, MS, MT, ND, NS, NT, PD, PS, PT, TD, TS, TT), release 008010, read from Stedi’s X12-licensed dictionary; the X12 text itself was not reached.
  • The function takes no release, so it accepts the superset. Release 005010 has 51 of the codes: 25–29 were added in release 006010 and are not valid in an 004010 or 005010 interchange, although this returns true for them.
  • TS, TT, CD and MD are codes of data element 1250 too, with unrelated meanings there. True here says the value is a time code; check a format qualifier with isValidX12DateTimePeriodFormat.
  • Membership is by the list, never by shape: 00 and 30 are two digits and are not codes.
  • Matching is exact: two characters, upper case, no padding.
  • Accepts any input type and returns false for non-string values.
  • True exactly when one of x12TimeCodeOffset and x12TimeCodeZone returns a value: the 31 codes that state an offset and the 25 that name a zone are the 56. A valid code says the value is in the list, not that it carries an offset: ES is valid and names a zone. classifyX12TimeCode says which of the two a code is, and narrows it for that reader.
ParameterTypeDescription
timeCodeunknowncandidate value of any type

boolean indicating validity

The 56 X12 data element 623 (Time Code) values, release 008010, read from Stedi’s X12-licensed dictionary; the X12 text itself was not reached.

import type { X12TimeCode } from "@northguild/gmt";
"TS" | "01" | "02" | "03" | "04" | "05" | "06" | "07" | "08" | "09" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "19" | "20" | "21" | "22" | "23" | "24" | "25" | "26" | "27" | "28" | "29" | "GM" | "UT" | "AD" | "AS" | "AT" | "CD" | "CS" | "CT" | "ED" | "ES" | "ET" | "HD" | "HS" | "HT" | "LT" | "MD" | "MS" | "MT" | "ND" | "NS" | "NT" | "PD" | "PS" | "PT" | "TD" | "TT"
import { isValidX12TimeCode } from "@northguild/gmt/intermodal/validate";
isValidX12TimeCode("ES") // true
output 

intermodal/validate/isValidX12TimeCode.ts