# isValidDutyLog

Industry: Workforce

## Signature

```ts
isValidDutyLog(log: unknown): boolean
```

Validate whether a value is a duty log every `workforce/` function accepts.

- True for an array of `{ status, start, end }` entries where `status` is a string and `start` and `end` are ISO 8601 instant strings (offset required, no leap second), `end` after `start`.
- Entries must be ordered by `start` and must not overlap. One may start exactly where the previous one ends, since entries are half-open, or later, leaving a gap. Order is by instant, not text.
- `[]` is a valid, empty log. Extra keys on an entry are ignored.
- Every other `workforce/` function returns its sentinel for a log this rejects.
- Returns `false` for a non-array, an entry that is not an object, a non-string status, a bound that is not an instant, a zero-length or inverted entry, and entries out of order or overlapping.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `log` | `unknown` | candidate array of `{ status, start, end }` records |

## Returns

boolean indicating whether the log is valid

## Examples

```ts
import { isValidDutyLog } from "@northguild/gmt/workforce/validate";

isValidDutyLog([{ status: "off", start: "2024-01-01T00:00:00Z", end: "2024-01-01T10:00:00Z" }, { status: "driving", start: "2024-01-01T10:00:00Z", end: "2024-01-01T15:00:00Z" }]) // true
```

## Source

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