# isValidDateUnit

Industry: Core

## Signature

```ts
isValidDateUnit(unit: unknown): unit is DateUnit
```

Return true when `unit` is a valid DateUnit.

- Valid units are: "year", "month", "week", "day".
- Accepts any input type and returns false for non-string values.
- Uses type assertion to narrow the type.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `unit` | `unknown` | candidate value of any type |

## Returns

boolean indicating validity

## Related types

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

## Examples

```ts
import { isValidDateUnit } from "@northguild/gmt/plain/validate";

isValidDateUnit("year") // true
```

## Source

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