# isValidEpcisEventTime

Industry: Intermodal

## Signature

```ts
isValidEpcisEventTime(value: string): boolean
isValidEpcisEventTime(value: void | {} | null | undefined): boolean
isValidEpcisEventTime(value: unknown): value is string
```

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`.
- A value that is not a string, a `String` object included, returns false. A true result narrows an `unknown` value to `string`.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` | any value; a string is checked as an EPCIS `eventTime` |

## Returns

boolean indicating validity

## Examples

```ts
import { isValidEpcisEventTime } from "@northguild/gmt/intermodal/validate";

isValidEpcisEventTime("2024-06-15T14:30:00Z") // true
```

## Source

[intermodal/validate/isValidEpcisEventTime.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/intermodal/validate/isValidEpcisEventTime.ts)
