# isValidEdifactTime

Industry: Intermodal

## Signature

```ts
isValidEdifactTime(value: string, format: EdifactTimeFormat): boolean
```

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

- ### Format codes

  | Code | Mask | The directory's description |
  |---|---|---|
  | `401` | `HHMM` | "Time without seconds: H = Hour; m = Minute." |
  | `402` | `HHMMSS` | "Time with seconds: H = Hour; m = Minute; s = Seconds." |

- True exactly when `parseEdifactTime` returns a time for the same arguments: the validator shares the parser's core, so the two cannot disagree.
- A value is valid only against its code: `"1430"` is a `401` value and not a `402` one.
- Hour 24, minute 60 and second 60 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. "1430") |
| `format` | `EdifactTimeFormat` | The data element 2379 format code |

## Returns

boolean indicating validity

## Related types

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

## Examples

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

isValidEdifactTime("1430", "401") // true
```

## Source

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