# isValidBusinessCalendar

Industry: Core

## Signature

```ts
isValidBusinessCalendar(calendar: unknown): calendar is BusinessCalendar
```

Return true when `calendar` is a `BusinessCalendar` the business-day functions accept.

- `weekend` must be an array of ISO weekday integers, 1 (Monday) through 7 (Sunday). Duplicates are ignored and `[]` is valid — a calendar with no weekly closure.
- All seven weekdays being weekend is **invalid**: such a calendar has no business day, so `nextBusinessDay` and every other walk would have nothing to walk to.
- `holidays` must be an array of ISO PlainDate strings. `[]` is valid. A datetime, a leap second or a date that does not exist is not.
- `timeZone` must be a valid IANA identifier. It records which locality the calendar describes; the business-day functions never read it, because they work on local dates.
- Returns `false` for non-objects, `null` and arrays.
- Use it to tell a legitimate result from `mergeCalendars` apart from its invalid-input sentinel, which is also `null`, and to tell a misconfigured calendar apart from a bad date when a business-day function returns `""`.

## Parameters

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

## Returns

boolean indicating whether every business-day function accepts it

## Related types

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

## Examples

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

isValidBusinessCalendar({ weekend: [6, 7], holidays: [], timeZone: "UTC" }) // true
```

## Source

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