Skip to content

Calendar API

Use the package's date, interval, validation, lane, and event-change exports by their current signatures.

Import

Import core functions and types from @ghost-ui/core/calendar-core. This entry has no React or CSS dependency. CalendarDataOptions describes the core input. Import the React Calendar component and its CalendarProps type from @ghost-ui/core/components/calendar; see the component API.

Date and interval functions

CalendarDay contains date, startMs, endMs, minutes, and ticks. CalendarInterval contains its event, instant bounds, point, and allDay. An event without an end is a point only when timed; an all-day event ends at the next local midnight.

Event and layout functions

Event changes

changeCalendarEvent(event, options) returns a new proposal. options requires action: "move" | "resize-start" | "resize-end" and timeZone; optional values are deltaMinutes (0), deltaDays (0), dateResize (false), and snapDuration (15). All-day edits use calendar dates. Timed edits return ISO timestamps. It throws when input deltas are non-finite, snapping is invalid, event.editable is false, a point is resized, the result is too short, or a timed resize leaves its original local day without dateResize.

The public types are CalendarOverlapGroup, CalendarView, CalendarResource, CalendarParticipant, CalendarEventStatus, CalendarActor, CalendarResponse, CalendarParticipation, CalendarAttendance, CalendarProposal, CalendarEventAction, CalendarConflict, CalendarEvent, CalendarTimeZoneChoice, CalendarSlot, CalendarChangeAction, CalendarTick, CalendarDay, CalendarInterval, CalendarSegment, CalendarValidation, CalendarDataOptions. Their event identity, date, and interval semantics are described in Calendar data; controlled callbacks and persistence ownership are in Calendar state.