# isValidFiscalCalendar

Industry: Core

## Signature

```ts
isValidFiscalCalendar(calendar: unknown): calendar is FiscalCalendar
```

Return true when `calendar` is a `FiscalCalendar` that `getFiscalPeriod` accepts.

- `pattern` must be `"4-5-4"`, `"4-4-5"` or `"5-4-4"`.
- `yearEndsOn` must be a plain ISO date. A datetime or a date that does not exist is not.
- `extraWeek` must be `"firstPeriod"` or `"lastPeriod"`, and `yearLabel` must be `"startYear"`, `"endYear"` or `"majorityYear"`. Both are required: there is no default.
- Extra properties are ignored.
- Returns `false` for non-objects, `null` and arrays.
- `getFiscalPeriod` returns null for a calendar this rejects, the same sentinel it returns for an invalid date. Check the calendar here to tell the two apart.

## Parameters

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

## Returns

boolean indicating whether `getFiscalPeriod` accepts it

## Related types

- [`FiscalCalendar`](/gmt/reference/types/FiscalCalendar/)
- [`FiscalPattern`](/gmt/reference/types/FiscalPattern/)
- [`FiscalExtraWeek`](/gmt/reference/types/FiscalExtraWeek/)
- [`FiscalYearLabel`](/gmt/reference/types/FiscalYearLabel/)

## Examples

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

isValidFiscalCalendar({ pattern: "4-5-4", yearEndsOn: "2026-01-31", extraWeek: "lastPeriod", yearLabel: "startYear" }) // true
```

## Source

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