isValidEdifactTime
Signature
Section titled “Signature”isValidEdifactTime(value: string, format: EdifactTimeFormat): booleanReturn true when value is a UN/EDIFACT DTM value (data element 2380) that states a real time of day in a time format code (data element 2379).
-
Format codes
Section titled “Format codes”Code Mask The directory’s description 401HHMM“Time without seconds: H = Hour; m = Minute.” 402HHMMSS“Time with seconds: H = Hour; m = Minute; s = Seconds.” -
True exactly when
parseEdifactTimereturns a time for the same arguments: the validator calls the parser, so the two cannot disagree. -
A value is valid only against its code:
"1430"is a401value and not a402one. -
Hour 24, minute 60 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 (e.g. “1430”) |
format | EdifactTimeFormat | The data element 2379 format code |
Returns
Section titled “Returns”boolean indicating validity
Related types
Section titled “Related types”Examples
Section titled “Examples”import { isValidEdifactTime } from "@northguild/gmt/intermodal/validate";
isValidEdifactTime("1430", "401") // true