# isValidEdifactDate

Industry: Intermodal

## Signature

```ts
isValidEdifactDate(value: string, format: "102"): boolean
```

Return true when `value` is a UN/EDIFACT `DTM` value (data element 2380) that states a real calendar date in a date format code (data element 2379).

- ### Format code

  | Code | Mask | The directory's description |
  |---|---|---|
  | `102` | `CCYYMMDD` | "Calendar date: C = Century ; Y = Year ; M = Month ; D = Day." |

- True exactly when `parseEdifactDate` returns a date for the same arguments: the validator shares the parser's core, so the two cannot disagree.
- Checks the calendar as well as the shape: 31 June 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. "20240615") |
| `format` | `"102"` | The data element 2379 format code |

## Returns

boolean indicating validity

## Related types

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

## Examples

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

isValidEdifactDate("20240615", "102") // true
```

## Source

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