isValidEpcisTimeZoneOffset
Signature
Section titled “Signature”isValidEpcisTimeZoneOffset(value: string): booleanReturn true when value is a GS1 EPCIS 2.0 eventTimeZoneOffset: the UTC offset the local clock ran at where a supply-chain event happened, written ±HH:MM.
- EPCIS (ISO/IEC 19987) is GS1’s event standard for supply-chain visibility. This is the check
isValidEpcisEventapplies to the event’seventTimeZoneOffsetfield: that validator calls this one. - The value must match
epcisTimeZoneOffset, the pattern the EPCIS JSON schema gives:±HH:MMfrom-14:00to+14:00, the rule of EPCIS Standard Release 2.0 §7.4.1 (https://ref.gs1.org/standards/epcis/). - The pattern is the whole rule for a string. Every value it matches is an offset Temporal reads, so this validator and
epcisTimeZoneOffset.testagree on every string; the validator adds only the answer false for a non-string. Z,+0200,+02, an offset with seconds and an offset past14:00are false.-00:00is true: the GS1 pattern matches it.parseEpcisEventreturns it as+00:00.- It need not agree with an offset written in the event’s
eventTime. Check that field withisValidEpcisEventTime, or both withisValidEpcisEvent.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | candidate EPCIS eventTimeZoneOffset string |
Returns
Section titled “Returns”boolean indicating validity
Examples
Section titled “Examples”import { isValidEpcisTimeZoneOffset } from "@northguild/gmt/intermodal/validate";
isValidEpcisTimeZoneOffset("-05:00") // true