Skip to content

isValidEdifactDate

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

Return true when value is a UN/EDIFACT DTM value (data element 2380) that states a real calendar date in a date format code (data element 2379).

  • CodeMaskThe directory’s description
    102CCYYMMDD“Calendar date: C = Century ; Y = Year ; M = Month ; D = Day.”
  • True exactly when parseEdifactDate returns a date for the same arguments: the validator calls the parser, so the two cannot disagree.

  • Checks the calendar as well as the shape: 31 June and 29 February 2023 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. “20240615”)
format"102"The data element 2379 format code

boolean indicating validity

import { isValidEdifactDate } from "@northguild/gmt/intermodal/validate";
isValidEdifactDate("20240615", "102") // true
output 

intermodal/validate/isValidEdifactDate.ts