```tsx
import { navigate, canNavigate, goToMonth, goToYear, goToNextMonth, goToPrevMonth } from '@gentleduck/calendar'
import type { Navigation, Adapter } from '@gentleduck/calendar'
```

## Functions

### `navigate`

Navigate to the next or previous month, year, or decade. Pure function.

```tsx
navigate(adapter: Adapter.IDateAdapter<TDate>, date: TDate, direction: Navigation.Direction, unit: Navigation.Unit) => TDate
```

| Param | Type | Description |
| :--- | :--- | :--- |
| `adapter` | `Adapter.IDateAdapter<TDate>` | Date adapter |
| `date` | `TDate` | Current date |
| `direction` | `Navigation.Direction` | Navigation direction |
| `unit` | `Navigation.Unit` | Navigation unit |

**Returns** the new date after navigation.

***

### `canNavigate`

Check whether navigation in a given direction is allowed, respecting `fromDate` and `toDate` constraints.

```tsx
canNavigate(
  adapter: Adapter.IDateAdapter<TDate>,
  date: TDate,
  direction: Navigation.Direction,
  unit: Navigation.Unit,
  constraints?: { fromDate?: TDate; toDate?: TDate }
) => boolean
```

| Param | Type | Description |
| :--- | :--- | :--- |
| `adapter` | `Adapter.IDateAdapter<TDate>` | Date adapter |
| `date` | `TDate` | Current date |
| `direction` | `Navigation.Direction` | Direction to check |
| `unit` | `Navigation.Unit` | Navigation unit |
| `constraints` | `{ fromDate?: TDate; toDate?: TDate }` | Optional bounds. `fromDate` is the earliest navigable date, `toDate` is the latest. |

**Returns** `true` if navigation is within bounds.

***

## Helper functions

### `goToMonth`

Navigate to a specific month within the current year. Used by the month picker view. The `month` parameter is **0-indexed** (0 = January, 11 = December). Returns the 1st of the target month.

```tsx
import { goToMonth } from '@gentleduck/calendar'

goToMonth(adapter: Adapter.IDateAdapter<TDate>, current: TDate, month: number) => TDate
```

### `goToYear`

Navigate to a specific year. Used by the year picker view.

```tsx
goToYear(adapter: Adapter.IDateAdapter<TDate>, current: TDate, year: number) => TDate
```

### `goToNextMonth`

Shorthand for `navigate(adapter, date, 'next', 'month')`.

```tsx
goToNextMonth(adapter: Adapter.IDateAdapter<TDate>, current: TDate) => TDate
```

### `goToPrevMonth`

Shorthand for `navigate(adapter, date, 'prev', 'month')`.

```tsx
goToPrevMonth(adapter: Adapter.IDateAdapter<TDate>, current: TDate) => TDate
```