Skip to content

isValidEdifactTime

  • Container free time, demurrage, billing deadlines, bill of lading dates and EDI timestamps.
isValidEdifactTime(value: string, format: EdifactTimeFormat): boolean

Return 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).

  • CodeMaskThe directory’s description
    401HHMM“Time without seconds: H = Hour; m = Minute.”
    402HHMMSS“Time with seconds: H = Hour; m = Minute; s = Seconds.”
  • True exactly when parseEdifactTime returns 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 a 401 value and not a 402 one.

  • 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.

ParameterTypeDescription
valuestringThe data element 2380 value (e.g. “1430”)
formatEdifactTimeFormatThe data element 2379 format code

boolean indicating validity

import { isValidEdifactTime } from "@northguild/gmt/intermodal/validate";
isValidEdifactTime("1430", "401") // true
output 

intermodal/validate/isValidEdifactTime.ts