isValidOperatingSchedule
Signature
Section titled “Signature”isValidOperatingSchedule(schedule: unknown): schedule is OperatingScheduleReturn true when schedule is an OperatingSchedule the operating-hours functions accept.
timeZonemust be a time zone identifier ("Europe/Paris","+05:30","+0530","-08") or a stored offset±HH:MM[:SS]("-00:44:30"), asisValidTimeZoneorisValidUtcOffsetaccepts.weeklymust be an object whose own enumerable keys are"1"–"7", Monday to Sunday. A weekday is read with a property get, so an inherited one applies. A weekday that is absent orundefinedis closed; any other value must be an array of windows.{}is valid and is closed every day. AMaphas no such keys, so it is valid and reads as closed every day.- A window is
{ from, to }, both plain times ("HH:MM"or"HH:MM:SS"with an optional fraction).toat or beforefromcrosses midnight;"00:00"to"00:00"is a whole day."24:00", a second of 60 and a time with an offset orTare not plain times. holidaysis optional: an array of ISO PlainDate strings, or aBusinessCalendar, which must passisValidBusinessCalendarthough only itsholidaysare read.overridesis optional: an array of{ date, windows }. Two overrides for one date, however the date is spelt, are invalid.- Dates take no annotation (
"2024-05-15[u-ca=iso8601]"is invalid) and lie between-271821-04-19and+275760-09-13, Temporal’s limits. - Other keys on the schedule, a window or an override are ignored, so a misspelt key such as
holidayis not an error. - Returns
falsefor non-objects,nulland arrays. A function carrying the fields is accepted. - Use it to tell a closed schedule from an invalid one:
operatingIntervalsreturns[]andisOpenAtreturnsfalsefor both.nextOpenAt,nextCloseAtandaddOperatingTimesearch a horizon and return""for an invalid schedule and for no answer within it.operatingTimeBetweenhas no horizon: it returns""for an invalid schedule and"PT0S"for a valid closed one.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
schedule | unknown | candidate value of any type |
Returns
Section titled “Returns”boolean indicating whether every operating-hours function accepts it
Related types
Section titled “Related types”Examples
Section titled “Examples”import { isValidOperatingSchedule } from "@northguild/gmt/calendar/validate";
isValidOperatingSchedule({ timeZone: "Europe/Paris", weekly: { 1: [{ from: "09:00", to: "17:00" }] } }) // trueSource
Section titled “Source”Accessibility
© 2026 NorthGuild · Licences
Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.