slots library

When can this provider be booked? Weekly hours and dated exceptions in the provider's own zone, minus what is busy, cut into slots, with buffers, notice, horizon and a daily cap. Pure Dart, no clock read: the same answer on the phone, on the server and on the web (owner's decisions 14, 15 and 18–21, 2026-11-08).

Classes

Availability
When the provider can be booked, in the provider's own zone.
Busy
Something already taking the time.
DateException
A date that does not follow the week: closed, or its own windows. It replaces every window that opens on that date (weekly and rules alike).
RuleWindow
Open on the dates of an RFC 5545 rule (FREQ=MONTHLY;BYDAY=1SA) from its first date start, window each.
Slot
A bookable slot, in the provider's zone (withTimeZone(client) shows it in another).
SlotAccepted
SlotCheck
SlotRefused
SlotRequest
The web's whole query read from JSON: the rules, and the range when it has one (a checkSlot may go without).
SlotRules
How a provider is booked — kept per provider, asked over any range (findSlots, checkSlot). Lengths are real (elapsed) time. A value that cannot be right (a duration under a minute, a negative buffer) is said as invalid-slot-query, never thrown.
SlotsResult
What findSlots gives: the slots, and what was dropped or refused.
WallTime
A wall-clock time of an opening: 00:00 to 24:00 inclusive, where endOfDay (24:00) is the next midnight — what an opening "until midnight" ends at, which a PlainTime cannot say (owner's decision 20, 2026-11-08). Used by business hours and by the slots' windows alike.
WeeklyWindow
Open on these ISO weekdays (1 Monday … 7 Sunday), window each.
Window
Open from from to to, wall times of the provider's zone. An end at or before the start crosses midnight; WallTime.endOfDay is the next midnight.

Enums

BusyKind
A booking is an appointment: it gets the same buffers as a new slot and counts toward the daily cap. A block (leave, a meeting in another agenda) only takes its time.
SlotRefusal
Why checkSlot refused a start.

Functions

busyFromEvents(Iterable<CalEvent> events, ZoneId zone) → List<Busy>
The busy time of calendar events (those with busy, the default unless cancelled): a timed event is a booking, an all-day one blocks its whole dates in the provider's zone.
checkSlot(SlotRules rules, Object start, {Instant? from, Instant? to}) → SlotCheck
Whether start is one of the slots findSlots would offer — what a server asks before saving a booking, with the same rules as the page. start is an Instant, a ZonedDateTime or their ISO text (as a request body has it; a time written below the millisecond is misaligned, slots never are). Without from/to, the range is the slot itself.
findSlots(SlotRules rules, {required Instant from, required Instant to}) → SlotsResult
The bookable slots starting at or after from and ending at or before to: the openings of the provider's week and exceptions, cut into slots of duration, minus what is busy (with buffers), too soon (minNotice), too far (maxAdvanceDays) or on a full date (maxPerDay). Bad input never throws: it is in the problems.
readMoment(Object? m) → Instant?
readMomentExact's instant; null when it cannot be read.