Skip to content

isValidEpcisEventTime

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

Return true when value is a real GS1 EPCIS 2.0 eventTime: the moment a supply-chain event happened, written as a date and time with Z or a UTC offset.

  • EPCIS (ISO/IEC 19987) is GS1’s event standard for supply-chain visibility. This is the check isValidEpcisEvent applies to the event’s eventTime field: that validator calls this one.
  • The value must match epcisEventTime, the DateTimeStamp pattern of the EPCIS XSD: YYYY-MM-DDTHH:MM:SS, an optional fraction, then Z or a ±HH:MM offset up to 14:00. Seconds are required, T and Z are upper-case, and nothing may follow.
  • Checks the calendar as well as the shape. The pattern proves the shape alone, so it matches a day the month does not have: 2024-02-30 and 2023-02-29 are false here.
  • GMT rule: a fraction longer than nine digits is false, although the pattern matches a fraction of any length. An instant holds nanoseconds, and parseEpcisEvent does not drop digits.
  • False for a leap second (:60), a space separator, an expanded year and a bracketed zone, none of which the pattern matches.
  • An event also needs an eventTimeZoneOffset: check it with isValidEpcisTimeZoneOffset, or both fields with isValidEpcisEvent. Read an event with parseEpcisEvent.
  • False for a non-string.
ParameterTypeDescription
valuestringcandidate EPCIS eventTime string

boolean indicating validity

import { isValidEpcisEventTime } from "@northguild/gmt/intermodal/validate";
isValidEpcisEventTime("2024-06-15T14:30:00Z") // true
output 

intermodal/validate/isValidEpcisEventTime.ts