Skip to content

OperatingSchedule

Weekly opening hours in one zone, with dated exceptions.

import type { OperatingSchedule } from "@northguild/gmt";
MemberTypeDescription
timeZonestringThe time zone the windows are read in, an IANA name or UTC offset: a time zone identifier (+05:30, +0530, -08) or a stored offset (±HH:MM[:SS], what getTimeZoneOffset returns). A UTC offset such as "+02:00" observes no DST.
weeklyPartial<Record<IsoWeekday, LocalWindow[]>> (IsoWeekday, LocalWindow)The windows of each ISO weekday. A missing weekday, or [], is closed all day. Windows of one weekday may overlap or touch; they are merged.
holidays?BusinessCalendar | string[] (BusinessCalendar)The local dates that are closed, as ISO PlainDate strings. A BusinessCalendar can be passed directly: its holidays are read, and its weekend and timeZone are not, because weekly already says which weekdays open and timeZone above is the zone.
overrides?OperatingOverride[] (OperatingOverride)The single dates whose windows replace the weekly ones. An override wins over a holiday on the same date, and two overrides for one date make the schedule invalid.
type OperatingSchedule = {
/**
* The time zone the windows are read in, an IANA name or UTC offset: a time zone identifier
* (`+05:30`, `+0530`, `-08`) or a stored offset (`±HH:MM[:SS]`, what `getTimeZoneOffset`
* returns). A UTC offset such as `"+02:00"` observes no DST.
*/
timeZone: string;
/**
* The windows of each ISO weekday. A missing weekday, or `[]`, is closed all day. Windows of
* one weekday may overlap or touch; they are merged.
*/
weekly: Partial<Record<IsoWeekday, LocalWindow[]>>;
/**
* The local dates that are closed, as ISO PlainDate strings. A `BusinessCalendar` can be passed
* directly: its `holidays` are read, and its `weekend` and `timeZone` are not, because `weekly`
* already says which weekdays open and `timeZone` above is the zone.
*
* @defaultValue None. No date is closed as a holiday.
*/
holidays?: string[] | BusinessCalendar;
/**
* The single dates whose windows replace the weekly ones. An override wins over a holiday on the
* same date, and two overrides for one date make the schedule invalid.
*
* @defaultValue None. Every date follows the weekly pattern and the holidays.
*/
overrides?: OperatingOverride[];
};

types/operating-schedule.ts