isValidEdifactOffsetDateTime
Signature
Section titled “Signature”isValidEdifactOffsetDateTime(value: string, format: EdifactOffsetDateTimeFormat): booleanReturn true when value is a UN/EDIFACT DTM value (data element 2380) that states a real date and time with an offset from UTC, in a format code that carries one (data element 2379).
-
Format codes
Section titled “Format codes”Code Mask The directory’s description 205CCYYMMDDHHMMZHHMM“Calendar date including time and time zone expressed in hours and minutes.” 208CCYYMMDDHHMMSSZHHMM“Calendar date including time with seconds, with Time Zone” (D.12A and later) 303CCYYMMDDHHMMZZZ“See 203 plus Z=Time zone.” 304CCYYMMDDHHMMSSZZZ“See 204 plus Z=Time zone.” -
True exactly when
parseEdifactOffsetDateTimereturns a value for the same arguments: the validator calls the parser, so the two cannot disagree. -
The three
ZZZcharacters of303and304are valid only as an offset: a signed hour from00to23,UTCorGMT. An abbreviation such asCET, a broken offset (+24) and a loneZare false. -
Takes the unescaped element value:
"202406151430?+02"is false. -
Checks the calendar as well as the shape: 29 February 2023, hour 24 and second 60 are false.
-
False for any other code, a code of another kind included; check a code alone with
isValidEdifactDtmFormat. False for a non-string argument.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | The data element 2380 value, unescaped (e.g. “202406151430+0200”) |
format | EdifactOffsetDateTimeFormat | The data element 2379 format code |
Returns
Section titled “Returns”boolean indicating validity
Related types
Section titled “Related types”Examples
Section titled “Examples”import { isValidEdifactOffsetDateTime } from "@northguild/gmt/intermodal/validate";
isValidEdifactOffsetDateTime("202406151430+0200", "205") // true