Skip to content
Star

Calendar API

Look up Calendar core inputs, return values, and validation errors.

Import

Import date and event functions from @collectivecreation/ghost-ui/calendar-core. CalendarDataOptions defines the inputs to validateCalendarData. For rendering, import Calendar and CalendarProps from @collectivecreation/ghost-ui/components/calendar and see the React 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, CalendarTimeScale, CalendarTimeAxis, 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.

Time scale

CalendarTimeScale accepts a unit of minute, hour, day, month, or year, plus optional step and count. Both numbers must be integers from 1 to 120.

The Timeline view defaults to { unit: "hour", step: 1, count: 24 } and opens near the first event. The standalone axis helper defaults to { unit: "year", step: 1, count: 5 }. Its other unit defaults are 12 months, 7 days, 8 hours, or 12 minutes.

Year, month, and day axes start at the selected local unit boundary. Hour and minute axes start at local midnight and advance by elapsed time. Calendar reports a configuration error for an unsupported range.

CalendarTimeAxis contains startMs, endMs and ordered {startMs,endMs,label} ticks. The helpers have no React or stylesheet dependency. All-day event ends stay exclusive. Timeline uses the existing event callbacks and optional resources; Vertical scrolling and inspection do not mutate data.