Skip to content

isValidEdifactDateTime

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

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

  • CodeMaskThe directory’s description
    203CCYYMMDDHHMM“Calendar date including time with minutes”
    204CCYYMMDDHHMMSS“Calendar date including time with seconds”
  • True exactly when parseEdifactDateTime returns a date-time for the same arguments: the validator calls the parser, so the two cannot disagree.

  • A value is valid only against its code: "202406151430" is a 203 value and not a 204 one.

  • Checks the calendar as well as the shape: 31 June, 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.

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

boolean indicating validity

import { isValidEdifactDateTime } from "@northguild/gmt/intermodal/validate";
isValidEdifactDateTime("202406151430", "203") // true
output 

intermodal/validate/isValidEdifactDateTime.ts