# isValidZoneBucketUnit

Industry: Core

## Signature

```ts
isValidZoneBucketUnit(unit: unknown): unit is SmallestUnit<ZoneBucketUnit>
```

Return true when `unit` is a valid ZoneBucketUnit.

- Valid units are: "hour", "day", "week", "month", singular or plural (`"days"`), as Temporal §13.17 names a unit either way and `floorToZone`/`bucketRange` accept both.
- Accepts any input type and returns false for non-string values.
- Uses type assertion to narrow the type.
- Narrower than `isValidDateTimeUnit` on purpose: these are the boundaries a calendar in a zone actually has. Sub-hour units need no zone, and "year" is left out because the calendar and fiscal year questions are `getQuarter`'s and `getFiscalPeriod`'s.
- `floorToZone` returns "" and `bucketRange` returns [] for a unit they do not recognise — the same sentinels they return for an unusable instant. Check the unit here to tell a misconfigured rollup apart from a bad timestamp.

## Parameters

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

## Returns

boolean indicating validity

## Related types

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

## Examples

```ts
import { isValidZoneBucketUnit } from "@northguild/gmt/calendar/validate";

isValidZoneBucketUnit("hour") // true
```

## Source

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