# isValidEdifactDateTimePeriod

Industry: Intermodal

## Signature

```ts
isValidEdifactDateTimePeriod(value: string, format: "719"): boolean
```

Return true when `value` is a UN/EDIFACT `DTM` value (data element 2380) that states a period between two real local date-times, in a date-time period format code (data element 2379).

- ### Format code

  | Code | Mask | The directory's description |
  |---|---|---|
  | `719` | `CCYYMMDDHHMM-CCYYMMDDHHMM` | "A period of time which includes the century, year, month, day, hour and minute. Format of period to be given in actual message without hyphen." |

- True exactly when `parseEdifactDateTimePeriod` returns a period for the same arguments: the validator and the parser share one core, so the two cannot disagree.
- A period is valid in its wire form only, with no hyphen.
- A period whose end precedes its start is false; an end equal to its start is true.
- Checks the calendar as well as the shape: hour 24 and 29 February 2023 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.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` | The data element 2380 value (e.g. "202406151430202406201600") |
| `format` | `"719"` | The data element 2379 format code |

## Returns

boolean indicating validity

## Related types

- [`EdifactDateTimePeriodFormat`](/gmt/reference/types/EdifactDateTimePeriodFormat/)

## Examples

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

isValidEdifactDateTimePeriod("202406151430202406201600", "719") // true
```

## Source

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