Skip to content

BusinessCalendar

A jurisdiction’s working week: which weekdays are weekend, which dates are holidays, and which locality the answer is for.

import type { BusinessCalendar } from "@northguild/gmt";
MemberTypeDescription
weekendnumber[]The ISO weekday numbers closed every week, 1 (Monday) through 7 (Sunday). It is explicit because Saturday–Sunday is not universal: much of the Middle East is Friday–Saturday ([5, 6]), and some markets keep a one-day weekend ([7]). [] means no weekly closure, duplicates are ignored, and all seven days leave no business day and are invalid.
holidaysstring[]The dates closed in addition to the weekend, as ISO PlainDate strings ("2024-07-04"), never datetimes. Order does not matter and duplicates are ignored.
timeZonestringThe time zone recording which locality the calendar describes, an IANA name or a UTC offset to the minute (what isValidTimeZone accepts). It must be a valid zone, but the business-day functions never use it: they take and return local dates, so the answer is the same whatever it says. A caller holding an instant uses it to reduce that instant to a local date first, with floorToZone or getZonedDateTimeFields.
type BusinessCalendar = {
/**
* The ISO weekday numbers closed every week, 1 (Monday) through 7 (Sunday). It is explicit
* because Saturday–Sunday is not universal: much of the Middle East is Friday–Saturday
* (`[5, 6]`), and some markets keep a one-day weekend (`[7]`). `[]` means no weekly closure,
* duplicates are ignored, and all seven days leave no business day and are invalid.
*/
weekend: number[];
/**
* The dates closed in addition to the weekend, as ISO PlainDate strings (`"2024-07-04"`), never
* datetimes. Order does not matter and duplicates are ignored.
*/
holidays: string[];
/**
* The time zone recording which locality the calendar describes, an IANA name or a UTC offset to
* the minute (what `isValidTimeZone` accepts). It must be a valid zone, but the business-day
* functions never use it: they take and return local dates, so the answer is the same whatever it
* says. A caller holding an instant uses it to reduce that instant to a local date first, with
* `floorToZone` or `getZonedDateTimeFields`.
*/
timeZone: string;
};

types/business-calendar.ts