isValidEpcisEventTime
Signature
Section titled “Signature”isValidEpcisEventTime(value: string): booleanReturn 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
isValidEpcisEventapplies to the event’seventTimefield: that validator calls this one. - The value must match
epcisEventTime, theDateTimeStamppattern of the EPCIS XSD:YYYY-MM-DDTHH:MM:SS, an optional fraction, thenZor a±HH:MMoffset up to14:00. Seconds are required,TandZare 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-30and2023-02-29are 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
parseEpcisEventdoes 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 withisValidEpcisTimeZoneOffset, or both fields withisValidEpcisEvent. Read an event withparseEpcisEvent. - False for a non-string.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | candidate EPCIS eventTime string |
Returns
Section titled “Returns”boolean indicating validity
Examples
Section titled “Examples”import { isValidEpcisEventTime } from "@northguild/gmt/intermodal/validate";
isValidEpcisEventTime("2024-06-15T14:30:00Z") // true