@moltenship/calendar 1.0.0-rc.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -6
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/docs/accessibility.md +305 -0
- package/docs/agents/changes.md +449 -0
- package/docs/agents/coding-agents.md +116 -0
- package/docs/agents/connect.md +444 -0
- package/docs/agents/deleting.md +296 -0
- package/docs/agents/reference.md +511 -0
- package/docs/agents/server.md +317 -0
- package/docs/agents/webmcp.md +153 -0
- package/docs/agents.md +355 -0
- package/docs/annotations.md +198 -0
- package/docs/api/changes.md +264 -0
- package/docs/api/components.md +245 -0
- package/docs/api/dnd-kit.md +265 -0
- package/docs/api/events.md +153 -0
- package/docs/api/primitives.md +218 -0
- package/docs/api/store.md +92 -0
- package/docs/api.md +57 -0
- package/docs/availability.md +576 -0
- package/docs/comparison.md +278 -0
- package/docs/concepts/anatomy.md +73 -0
- package/docs/concepts/events.md +163 -0
- package/docs/concepts/how-it-works.md +112 -0
- package/docs/concepts/state.md +244 -0
- package/docs/concepts/time.md +168 -0
- package/docs/customization.md +271 -0
- package/docs/frameworks.md +116 -0
- package/docs/guides/dnd-kit.md +333 -0
- package/docs/guides/google-calendar-sync.md +1246 -0
- package/docs/guides/google-calendar.md +367 -0
- package/docs/guides/motion.md +414 -0
- package/docs/guides/nextjs-app-router.md +630 -0
- package/docs/guides/nextjs.md +149 -0
- package/docs/guides/performance.md +103 -0
- package/docs/guides/tanstack-query.md +485 -0
- package/docs/ics/feed.md +484 -0
- package/docs/ics/import.md +183 -0
- package/docs/ics/reference.md +482 -0
- package/docs/ics.md +142 -0
- package/docs/index.md +149 -0
- package/docs/installation.md +209 -0
- package/docs/interactions.md +441 -0
- package/docs/llms.txt +99 -0
- package/docs/migrating-to-2.md +497 -0
- package/docs/quick-start.md +163 -0
- package/docs/recurrence/calendar.md +598 -0
- package/docs/recurrence/model.md +128 -0
- package/docs/recurrence/reference.md +547 -0
- package/docs/recurrence.md +122 -0
- package/docs/stylex.md +290 -0
- package/docs/temporal/daylight-saving-time.md +172 -0
- package/docs/temporal/month-grid.md +119 -0
- package/docs/temporal/reference.md +167 -0
- package/docs/temporal.md +105 -0
- package/docs/testing.md +600 -0
- package/docs/theme-builder.md +82 -0
- package/docs/theming.md +275 -0
- package/docs/undo-redo.md +347 -0
- package/docs/views/agenda.md +222 -0
- package/docs/views/custom-views.md +195 -0
- package/docs/views/month.md +110 -0
- package/docs/views/resource-columns.md +265 -0
- package/docs/views/resource-timeline.md +226 -0
- package/docs/views/scrolling.md +193 -0
- package/docs/views/week-and-day.md +258 -0
- package/docs/views/year.md +138 -0
- package/docs/views.md +69 -0
- package/package.json +42 -14
- package/skills/moltenship-time/SKILL.md +77 -0
- package/skills/moltenship-time/references/agent-ready.md +272 -0
- package/skills/moltenship-time/references/changes.md +188 -0
- package/skills/moltenship-time/references/compose.md +175 -0
- package/skills/moltenship-time/references/mistakes.md +100 -0
- package/skills/moltenship-time/references/solid.md +213 -0
- package/skills/moltenship-time/references/state.md +129 -0
- package/skills/moltenship-time/references/testing.md +176 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# Comparison
|
|
2
|
+
|
|
3
|
+
How Time compares with FullCalendar and react-big-calendar, as of October 2026.
|
|
4
|
+
|
|
5
|
+
Source: https://time.molten.sh/docs/react/comparison
|
|
6
|
+
|
|
7
|
+
This page compares Time in a React app with two React calendars that many teams already use:
|
|
8
|
+
[FullCalendar](https://fullcalendar.io) 7.1, through `@fullcalendar/react` and its premium
|
|
9
|
+
plugins, and [react-big-calendar](https://github.com/bigcalendar/react-big-calendar) 1.20. It's
|
|
10
|
+
accurate as of **October 2026**, and Time's rows under [Maturity](#maturity) as of November 25, 2026. Claims about Time come from these docs and the code on `main`.
|
|
11
|
+
Claims about the other two link their sources in the notes at the end of the page; a ✗ without a
|
|
12
|
+
note means we found no such feature in their docs or code. If something here is wrong or out of
|
|
13
|
+
date, [open an issue](https://github.com/Moltenship/time/issues).
|
|
14
|
+
|
|
15
|
+
> **Time is new**
|
|
16
|
+
>
|
|
17
|
+
> Time started in August 2026 and has one maintainer. This page compares its React package; the
|
|
18
|
+
> SolidJS 2 one has the same engine and views, in Tailwind CSS. FullCalendar has been developed
|
|
19
|
+
> since 2009 and react-big-calendar since 2015. Both are downloaded more than a million times a week
|
|
20
|
+
> and run in production in many apps. Read the rows below with that in mind.
|
|
21
|
+
|
|
22
|
+
**✓** means built in. **Partial** means it's there, with the limit the note gives. **✗** means
|
|
23
|
+
it isn't built in: you'd write it yourself or add another library.
|
|
24
|
+
|
|
25
|
+
## License and pricing
|
|
26
|
+
|
|
27
|
+
| | Time | FullCalendar | react-big-calendar |
|
|
28
|
+
| --------------------------- | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
29
|
+
| License | ✓ MIT. `@moltenship/ics` adds Unicode-3.0 for its CLDR data | Partial. The standard views are MIT. The premium plugins have a commercial license[^fc-license] | ✓ MIT[^rbc-license] |
|
|
30
|
+
| Resource and timeline views | Free, MIT | Premium. $480 for one developer, less per seat for more, down to $240 a seat for ten. A one-time payment for perpetual use, with a year of upgrades and email support. Free for registered non-profits (CC BY-NC-ND) and for projects that are open source under the AGPLv3[^fc-license] | Resource columns are free. No timeline[^rbc-resources] |
|
|
31
|
+
|
|
32
|
+
## Views
|
|
33
|
+
|
|
34
|
+
| | Time | FullCalendar | react-big-calendar |
|
|
35
|
+
| --------------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
|
|
36
|
+
| Month | ✓ [Month](./views/month.md) | ✓ `dayGridMonth`[^fc-views] | ✓ `month`[^rbc-views] |
|
|
37
|
+
| Week and day | ✓ [Week and day](./views/week-and-day.md) | ✓ `timeGridWeek`, `timeGridDay`[^fc-views] | ✓ `week`, `work_week`, `day`[^rbc-views] |
|
|
38
|
+
| Agenda or list | ✓ [Agenda](./views/agenda.md), also as a scrolling list | ✓ `list` views, from a day to a year[^fc-views] | ✓ `agenda`[^rbc-views] |
|
|
39
|
+
| Year | ✓ [Year](./views/year.md). Read-only: a day's events open in a popover | ✓ `multiMonthYear`[^fc-views] | ✗ Not built in[^rbc-year] |
|
|
40
|
+
| 3-day and other spans | ✓ `createThreeDayView`. Other spans as a [custom view](./views/custom-views.md) | ✓ Any day count, set with `duration`[^fc-custom] | ✓ As a custom view. The docs' example is a 3-day view[^rbc-custom] |
|
|
41
|
+
| Scrolling without end | ✓ [Week, 3-day, day, month and agenda](./views/scrolling.md), as Apple's Calendar does on iPad | ✗ An open request since 2015[^fc-scrolling] | ✗ Not among its views[^rbc-views] |
|
|
42
|
+
| Resource columns | ✓ [Resource columns](./views/resource-columns.md), with groups that collapse | ✓ Premium: `resourceTimeGrid` and `resourceDayGrid`[^fc-resource] | Partial. In the day and week time grids only, not month or agenda[^rbc-resources] |
|
|
43
|
+
| Resource timeline | ✓ [Resource timeline](./views/resource-timeline.md) for a day, a week or a month | ✓ Premium, also as a timeline without resources[^fc-resource] | ✗ Not built in[^rbc-timeline] |
|
|
44
|
+
| Custom views | ✓ A strategy and a Renderer | Partial. New spans for the built-in types, or a view from scratch as a function or a React component. Its props aren't documented, and dragging is left to you[^fc-custom] | ✓ A component with `range`, `navigate` and `title`[^rbc-custom] |
|
|
45
|
+
|
|
46
|
+
## Interaction
|
|
47
|
+
|
|
48
|
+
| | Time | FullCalendar | react-big-calendar |
|
|
49
|
+
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
50
|
+
| Drag to move | ✓ In the month, time grid and resource views ([Interactions](./interactions.md#drag-resize-and-create)) | ✓ With the `interaction` plugin[^fc-dnd] | ✓ With the `withDragAndDrop` addon[^rbc-dnd] |
|
|
51
|
+
| Resize | Partial. Timed events in the time grids and resource columns, and bars in the timeline. All-day events, the month's included, from the keyboard only | ✓[^fc-dnd] | ✓[^rbc-dnd] |
|
|
52
|
+
| Create | ✓ Drag across empty time or days, or press Space on a slot or a day. A click doesn't create | ✓ Select a range, or handle a date click[^fc-dnd] | ✓ Select slots with a click or a drag[^rbc-dnd] |
|
|
53
|
+
| Touch | ✓ Press and hold for 450 ms to drag | ✓ Press and hold, 1 second by default, configurable[^fc-dnd] | Partial. Press and hold to select slots, 250 ms by default. Dragging an event by touch takes a tap first, and has reported bugs[^rbc-touch] |
|
|
54
|
+
| Keyboard move and resize | ✓ Space picks an event up and Shift+Space its edge, the arrow keys move or resize it, Enter saves it ([keyboard](./accessibility.md#changing-events)) | ✗ An open request since 2015[^fc-keyboard] | ✗ The addon handles no keys[^rbc-keyboard] |
|
|
55
|
+
| Drops from outside | Partial. With dnd-kit, the [dnd-kit adapter](./api/dnd-kit.md) turns your items dragged in into events and sends events dragged out to your drop zones. Other libraries call [`startCalendarDrop` and `monitorCalendarDrags`](./api/changes.md#drags-from-and-to-the-rest-of-the-page) through a binding you write. No HTML drag and drop | ✓ `Draggable`, or any drag library through `ThirdPartyDraggable`[^fc-external] | ✓ `onDropFromOutside`, with HTML drag and drop[^rbc-external] |
|
|
56
|
+
| Undo and redo | ✓ An opt-in [history](./undo-redo.md) with keyboard shortcuts and an undo toast | ✗ Each change has a `revert()`, but there's no history[^fc-revert] | ✗ |
|
|
57
|
+
|
|
58
|
+
## Accessibility
|
|
59
|
+
|
|
60
|
+
| | Time | FullCalendar | react-big-calendar |
|
|
61
|
+
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
62
|
+
| Keyboard navigation | ✓ Each view is one tab stop. Arrow, Home, End and Page keys move between days, slots and events ([Accessibility](./accessibility.md#keyboard)) | Partial. Tab reaches every interactive element. Events are focusable when they have a URL or an `eventClick` handler, or with `eventInteractive`. No arrow keys[^fc-a11y] | Partial. Time grid events are focusable; month events aren't. No arrow-key navigation[^rbc-a11y] |
|
|
63
|
+
| Screen reader announcements | ✓ A live region announces moves, resizes and creates, from the keyboard and the pointer. Events are named in full | Partial. ARIA attributes, and labels you can change. No announcements of changes found[^fc-a11y] | ✗ No live region. Open issues about the month view's roles and "+N more"[^rbc-a11y] |
|
|
64
|
+
| Automated checks | ✓ axe-core over every built-in view but the 3-day ones, in Chromium on every PR and in Firefox and WebKit before each release. Serious and critical issues fail. Contrast and target-size tests too. No WCAG conformance claim or third-party audit | Partial. The 7.0 notes say every view passes axe. We found no automated accessibility run in its public CI[^fc-a11y] | ✗ No axe tests[^rbc-a11y] |
|
|
65
|
+
| Right-to-left | ✓ Month, week, day and agenda mirror, and so do the arrow keys ([right-to-left](./accessibility.md#right-to-left)) | ✓ `direction: "rtl"`[^fc-rtl] | ✓ `rtl`[^rbc-rtl] |
|
|
66
|
+
|
|
67
|
+
## Time
|
|
68
|
+
|
|
69
|
+
| | Time | FullCalendar | react-big-calendar |
|
|
70
|
+
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
71
|
+
| Date values | Native Temporal: `Instant`, `PlainDate` and `PlainDateTime`. No `Date` ([Time](./concepts/time.md)) | `Date` in its API. Temporal inside, through the functions of `temporal-polyfill`, a peer dependency you install[^fc-time] | `Date`, with a localizer for moment, Luxon, Globalize, date-fns or Day.js[^rbc-time] |
|
|
72
|
+
| Temporal required | A global `Temporal`. In browsers without it, load a polyfill ([Installation](./installation.md#temporal)), which adds 20.5 kB gzipped | No global `Temporal`, but the `temporal-polyfill` package as a peer dependency[^fc-time] | No[^rbc-time] |
|
|
73
|
+
| Named time zones | ✓ Any IANA zone, changeable at runtime | ✓ Without a plugin since 7.0. The `Date`s it hands you are in local time or UTC, so its docs convert them with Temporal[^fc-time] | Partial. Through the localizer's default zone with moment-timezone, Luxon or Day.js. Not with date-fns[^rbc-time] |
|
|
74
|
+
| Daylight saving | ✓ 23- and 25-hour days, and skipped and repeated hours ([DST](./concepts/time.md#daylight-saving-time)) | No docs page. 7.1.0 fixed timeline slots across a change[^fc-dst] | Partial. The localizers adjust time slots for DST, but a bug remains open[^rbc-dst] |
|
|
75
|
+
| Secondary time zone | ✓ [Extra hour columns](./views/week-and-day.md#secondary-time-zones), which account for either zone's clock changes | ✗ An open request since 2017[^fc-secondary] | ✗ A request closed by a bot[^rbc-secondary] |
|
|
76
|
+
| Localization | Partial. Dates and times follow any `locale` through `Intl`. The views' own words are English in source you edit, and announcements take messages you pass | ✓ 79 locales for its words, screen reader labels, date formats and the first day of the week[^fc-locale] | ✓ `culture` from the localizer, and `messages` for its words[^rbc-locale] |
|
|
77
|
+
|
|
78
|
+
## Data
|
|
79
|
+
|
|
80
|
+
| | Time | FullCalendar | react-big-calendar |
|
|
81
|
+
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
82
|
+
| Recurring events | ✓ `@moltenship/calendar-recurrence`: RRULE, EXDATE and RDATE, overrides, and cancelled occurrences ([Recurring events](./recurrence/model.md)) | ✓ Simple daily or weekly recurrence built in. RRULE with `exdate` and `exrule` through the `rrule` plugin[^fc-rrule] | ✗ Declined by its creator in 2017[^rbc-recurrence] |
|
|
83
|
+
| Edit this, following or all | ✓ A scope dialog, and `resolveRecurrenceEdit` works out what to save ([guide](./recurrence/calendar.md)) | ✗ Not in the docs. `groupId` moves occurrences together[^fc-rrule] | ✗ |
|
|
84
|
+
| ICS import | ✓ `@moltenship/ics` parses RFC 5545 into Temporal values, with Windows zone names and line-numbered issues ([ICS](./ics/reference.md)) | ✓ The `icalendar` plugin loads a feed URL when the calendar loads, and again on `refetchEvents`[^fc-ics] | ✗ |
|
|
85
|
+
| ICS export | Partial. `stringifyIcsComponents` writes a syntax tree you build. No writer from typed events yet | ✗ Not in the docs[^fc-ics] | ✗ |
|
|
86
|
+
| Working hours | ✓ For the calendar and per resource, each in its own time zone, with closed days and holidays ([Availability](./availability.md)) | ✓ `businessHours`. Per resource in premium[^fc-hours] | Partial. No working hours setting. Shade time with `backgroundEvents` or `slotPropGetter`, per resource, and limit the hours shown with `min` and `max`[^rbc-hours] |
|
|
87
|
+
| Busy status | ✓ Busy and unavailable kept apart, with `busyAt`, `resourceStatusAt` and a busy badge | ✗ | ✗ |
|
|
88
|
+
| Conflict rules | ✓ Policies block, warn about or allow double-booking per resource, and keep changes inside working hours. Previews show the verdict while you drag | ✓ `eventOverlap`, `eventConstraint`, `eventAllow` and their `select` twins[^fc-hours] | ✗ `no-overlap` only changes the layout[^rbc-hours] |
|
|
89
|
+
| Pending changes, optimistic updates | ✓ An async `onEventChange` keeps the change on screen as pending and rolls it back if saving fails. Of racing changes, the newest shows; the docs show how to apply saves in order ([pending changes](./interactions.md#pending-changes)) | Partial. Callbacks get `revert()` to undo a failed save. No pending state[^fc-revert] | ✗ You update your state in `onEventDrop`[^rbc-state] |
|
|
90
|
+
|
|
91
|
+
## Architecture and integration
|
|
92
|
+
|
|
93
|
+
| | Time | FullCalendar | react-big-calendar |
|
|
94
|
+
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
|
|
95
|
+
| Headless core | ✓ The event engine, the Temporal helpers and the calendar's state and actions use no React. The React parts render plain elements ([How it works](./concepts/how-it-works.md)) | Partial. `@full-ui/headless-calendar`, MIT, is its internal core; its readme calls it a beta[^fc-headless] | ✗ |
|
|
96
|
+
| Frameworks | React and SolidJS 2: the same headless calendar, keyboard navigation and dragging, and the registry's styled views in both ([React and Solid](./frameworks.md)) | ✓ React, Vue 3, Angular, Preact, plain JavaScript and a web component[^fc-frameworks] | React only[^rbc-react] |
|
|
97
|
+
| React versions | 19 | 17 to 19[^fc-frameworks] | 16.14 to 19[^rbc-react] |
|
|
98
|
+
| Server rendering, Next.js | ✓ Renders the same markup on the server and in the browser. Calendars are Client Components. A full [App Router example](./guides/nextjs-app-router.md) with Server Actions | ✓ The React package is written in React since 7.0, with server rendering and StrictMode. A Next.js example project[^fc-react] | Partial. Its docs don't cover server rendering or Next.js. App Router users put it in a Client Component[^rbc-ssr] |
|
|
99
|
+
| Own the code | ✓ Every view's components, the toolbar and the theme are source files you add with the shadcn CLI ([UI source](./installation.md#ui-source-optional)). Date math, layout, and the drag and keyboard logic stay in `@moltenship/calendar` | Partial. A shadcn registry adds a wrapper, a toolbar and Tailwind classes for each part. The views' markup and behaviour stay in `@fullcalendar/react`[^fc-shadcn] | ✗ |
|
|
100
|
+
| Theming | ✓ CSS tokens for light and dark, an event palette, a [theme builder](./theme-builder.md), and the views in [Tailwind or StyleX](./stylex.md) | ✓ Five themes with dark mode, CSS variables, class names for Tailwind, and MUI and Bootstrap 5 themes[^fc-themes] | Partial. One stylesheet, with Sass variables to override[^rbc-theme] |
|
|
101
|
+
| TypeScript | ✓ Written in strict TypeScript. Your event and ID types carry through | ✓ Written in TypeScript, types included[^fc-frameworks] | Partial. Written in JavaScript. `@types/react-big-calendar` is at 1.16[^rbc-types] |
|
|
102
|
+
|
|
103
|
+
## Performance and size
|
|
104
|
+
|
|
105
|
+
| | Time | FullCalendar | react-big-calendar |
|
|
106
|
+
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
107
|
+
| Virtualization and large data | ✓ Resource columns, the resource timeline, the agenda and the scrolling views render only what's in view. Month and time grids render the visible range. Events sit in an interval index, so each view reads only its range ([Performance](./guides/performance.md)) | Partial. Opt-in and premium, for the resource timeline only. Other views are planned[^fc-virtual] | ✗ No virtualization. Reports about large data were closed by a bot, and a fix isn't merged[^rbc-perf] |
|
|
108
|
+
| Bundle size, gzipped | Measured on 1.x, before 2.0 added ui-sdk. 143 kB, or 67 kB if your app already ships Base UI's select, popover and tooltip, `cn` and lucide-react | 84 kB. 118 kB with the premium resource views | 99 kB with Luxon and a time zone. 85 kB with date-fns, without time zones |
|
|
109
|
+
|
|
110
|
+
### How the sizes were measured
|
|
111
|
+
|
|
112
|
+
Each library rendered the same calendar from one entry file: month, week, day and agenda (or list)
|
|
113
|
+
views, the library's toolbar, and dragging, resizing and creating turned on, in the Europe/Berlin
|
|
114
|
+
time zone. For Time, that's the [Quick start](./quick-start.md)'s calendar with `onEventChange` and
|
|
115
|
+
the `Announcer` added, built from the registry source that `shadcn add` copies, at commit
|
|
116
|
+
`ed3f9a1b`, which is a 1.x build: it doesn't count `@ui-sdk/core` and `@ui-sdk/react`, which 2.0
|
|
117
|
+
adds. FullCalendar used its classic theme. react-big-calendar used its Luxon localizer, since
|
|
118
|
+
its date-fns localizer can't take a time zone, and its drag-and-drop addon, imported from
|
|
119
|
+
`react-big-calendar/lib/addons/dragAndDrop` as its docs show; that path is CommonJS and brings a
|
|
120
|
+
second copy of some modules. Each entry was bundled with esbuild 0.28.2
|
|
121
|
+
(`--bundle --minify --format=esm --target=es2022`), with React and React DOM left out and CSS not
|
|
122
|
+
counted, then compressed with `gzip -9`. A kB is 1,000 bytes.
|
|
123
|
+
|
|
124
|
+
| Bundle | Minified | Minified and gzipped |
|
|
125
|
+
| ---------------------------------------------------------------------------------------- | -------- | -------------------- |
|
|
126
|
+
| Time: week, day, month and agenda, with the toolbar and the shadcn components they use | 430 kB | 142.6 kB |
|
|
127
|
+
| The same, without the shadcn stack: Base UI, Floating UI, `cn`, lucide-react and helpers | 218 kB | 67.3 kB |
|
|
128
|
+
| Time with resource columns and the resource timeline added | 481 kB | 157.6 kB |
|
|
129
|
+
| The same, without the shadcn stack: Base UI, Floating UI, `cn`, lucide-react and helpers | 269 kB | 82.1 kB |
|
|
130
|
+
| `temporal-polyfill/global` 1.0.6, for browsers without Temporal | 59 kB | 20.5 kB |
|
|
131
|
+
| FullCalendar 7.1.2: month, week, day and list, with interaction | 301 kB | 84.3 kB |
|
|
132
|
+
| FullCalendar 7.1.2 with premium resource timeline and resource time grid | 429 kB | 118.0 kB |
|
|
133
|
+
| react-big-calendar 1.20.0 with drag and drop and Luxon 3.7 | 323 kB | 98.6 kB |
|
|
134
|
+
| react-big-calendar 1.20.0 with drag and drop and date-fns 4.4, without time zones | 288 kB | 84.9 kB |
|
|
135
|
+
|
|
136
|
+
Time's views are the largest of the three. About half of their minified size is the shadcn
|
|
137
|
+
components they're built on: Base UI's select, popover and tooltip, with Floating UI. An app that
|
|
138
|
+
already uses those through shadcn/ui ships that code already, which is what the "without" rows show.
|
|
139
|
+
FullCalendar's numbers include the parts of `temporal-polyfill` it imports. Time's don't include a
|
|
140
|
+
polyfill, which only browsers without Temporal need.
|
|
141
|
+
|
|
142
|
+
## Maturity
|
|
143
|
+
|
|
144
|
+
| | Time | FullCalendar | react-big-calendar |
|
|
145
|
+
| ------------------------------ | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | ------------------------------------------------- |
|
|
146
|
+
| Since | August 2026 | 2009[^fc-maturity] | 2015[^rbc-maturity] |
|
|
147
|
+
| Latest release | 2.0.0-beta.1, a pre-release, November 25, 2026 | 7.1.2, October 12, 2026[^fc-maturity] | 1.20.0, June 1, 2026[^rbc-maturity] |
|
|
148
|
+
| Releases in the last 12 months | 3: two release candidates and one beta | 8[^fc-maturity] | 2[^rbc-maturity] |
|
|
149
|
+
| Weekly npm downloads | 9 for `@moltenship/calendar` in the week of November 17, 2026. First published in October 2026 | 1.8 million for `@fullcalendar/react`[^fc-downloads] | 1.17 million[^rbc-downloads] |
|
|
150
|
+
| GitHub | 1 contributor | 20.7k stars, about 130 contributors[^fc-maturity] | 8.8k stars, about 240 contributors[^rbc-maturity] |
|
|
151
|
+
| Support | GitHub issues | Community support, and email support with a premium license[^fc-license] | GitHub issues[^rbc-maturity] |
|
|
152
|
+
|
|
153
|
+
FullCalendar and react-big-calendar have years of bug reports behind them, answers on Stack
|
|
154
|
+
Overflow, example projects and people who know them. Time has none of that yet.
|
|
155
|
+
|
|
156
|
+
## When to choose which
|
|
157
|
+
|
|
158
|
+
**FullCalendar** if you need a calendar you can rely on in production today, if your app uses Vue,
|
|
159
|
+
Angular or no framework, if you need many locales out of the box, or if you want a vendor with paid
|
|
160
|
+
support. Its premium views cost money, but less than building a scheduler. Its React package has
|
|
161
|
+
been written in React since 7.0, renders on the server, handles named time zones through Temporal
|
|
162
|
+
and has shadcn themes, so none of those set Time apart.
|
|
163
|
+
|
|
164
|
+
**react-big-calendar** if you want a free MIT calendar with month, week, day and agenda views and
|
|
165
|
+
drag and drop, and you don't need a year view, a timeline, keyboard editing, recurring events or
|
|
166
|
+
time zones beyond a localizer's default. It had two releases in the last twelve months, so expect
|
|
167
|
+
fixes to come slowly.
|
|
168
|
+
|
|
169
|
+
**Time** if you're on React 19, and you want Temporal from end to
|
|
170
|
+
end, view components you own as source, editing by keyboard with screen reader announcements,
|
|
171
|
+
edits to recurring series, availability and conflict rules, resource views under the MIT license,
|
|
172
|
+
or a calendar an [AI agent](./agents.md) can read and change under your app's rules. Don't choose
|
|
173
|
+
it yet if you need a stable release with a track record, or styled views for a framework other
|
|
174
|
+
than React and Solid.
|
|
175
|
+
|
|
176
|
+
[^fc-license]: FullCalendar's [pricing](https://fullcalendar.io/pricing), [purchase](https://fullcalendar.io/purchase) and [license](https://fullcalendar.io/license) pages, its [premium](https://fullcalendar.io/docs/premium) docs, and the [plugin index](https://fullcalendar.io/docs/plugin-index), which marks the premium plugins.
|
|
177
|
+
|
|
178
|
+
[^rbc-license]: react-big-calendar's [LICENSE](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/LICENSE).
|
|
179
|
+
|
|
180
|
+
[^fc-views]: FullCalendar's [month](https://fullcalendar.io/docs/month-view), [time grid](https://fullcalendar.io/docs/timegrid-view), [list](https://fullcalendar.io/docs/list-view) and [multi-month](https://fullcalendar.io/docs/multimonth-grid) views.
|
|
181
|
+
|
|
182
|
+
[^rbc-views]: react-big-calendar's [`src/Views.js`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/Views.js#L8-L14).
|
|
183
|
+
|
|
184
|
+
[^rbc-year]: [#2375](https://github.com/bigcalendar/react-big-calendar/issues/2375), "Need a year view", closed by a bot in May 2026.
|
|
185
|
+
|
|
186
|
+
[^fc-custom]: FullCalendar's [custom view with settings](https://fullcalendar.io/docs/custom-view-with-settings) and [custom view with JS](https://fullcalendar.io/docs/custom-view-with-js).
|
|
187
|
+
|
|
188
|
+
[^fc-scrolling]: [fullcalendar#2276](https://github.com/fullcalendar/fullcalendar/issues/2276), "Continuous scrolling of months".
|
|
189
|
+
|
|
190
|
+
[^rbc-custom]: react-big-calendar's [Creating custom views](https://bigcalendar.github.io/react-big-calendar/?path=/docs/guides-creating-custom-views--docs) and its [3-day example](https://bigcalendar.github.io/react-big-calendar/?path=/story/examples--example-9).
|
|
191
|
+
|
|
192
|
+
[^fc-resource]: FullCalendar's [vertical resource view](https://fullcalendar.io/docs/vertical-resource-view) and [timeline view](https://fullcalendar.io/docs/timeline-view), both premium.
|
|
193
|
+
|
|
194
|
+
[^rbc-resources]: Only the time grid reads `resources`: [`src/TimeGrid.js`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/TimeGrid.js#L256-L258). See the [resource scheduling example](https://bigcalendar.github.io/react-big-calendar/?path=/story/examples--example-11).
|
|
195
|
+
|
|
196
|
+
[^rbc-timeline]: [#1844](https://github.com/bigcalendar/react-big-calendar/issues/1844), "Resource Timeline component", closed by a bot in May 2026.
|
|
197
|
+
|
|
198
|
+
[^fc-dnd]: FullCalendar's [dragging and resizing](https://fullcalendar.io/docs/event-dragging-resizing), [`selectable`](https://fullcalendar.io/docs/selectable), [touch](https://fullcalendar.io/docs/touch) and [`eventLongPressDelay`](https://fullcalendar.io/docs/eventLongPressDelay).
|
|
199
|
+
|
|
200
|
+
[^rbc-dnd]: react-big-calendar's [`withDragAndDrop`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/addons/dragAndDrop/withDragAndDrop.js#L17-L29), [`selectable`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/Calendar.js#L527-L534) and [`onSelectSlot`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/Calendar.js#L331-L359).
|
|
201
|
+
|
|
202
|
+
[^rbc-touch]: react-big-calendar's [`longPressThreshold`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/Calendar.js#L537-L544), the addon's [`EventWrapper.js`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/addons/dragAndDrop/EventWrapper.js#L41-L61), and [#2413](https://github.com/bigcalendar/react-big-calendar/issues/2413), "Drag and drop on touch".
|
|
203
|
+
|
|
204
|
+
[^fc-keyboard]: [fullcalendar#2535](https://github.com/fullcalendar/fullcalendar/issues/2535), "Event drag-n-drop / resize with keyboard", open since 2015.
|
|
205
|
+
|
|
206
|
+
[^rbc-keyboard]: The addon's [`withDragAndDrop.js`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/addons/dragAndDrop/withDragAndDrop.js) has no key handling, and [`src/Selection.js`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/Selection.js#L360) uses Escape only to cancel.
|
|
207
|
+
|
|
208
|
+
[^fc-external]: FullCalendar's [external dragging](https://fullcalendar.io/docs/external-dragging) and [third-party dragging](https://fullcalendar.io/docs/third-party-dragging).
|
|
209
|
+
|
|
210
|
+
[^rbc-external]: react-big-calendar's [drag from outside example](https://bigcalendar.github.io/react-big-calendar/?path=/story/addons-drag-and-drop--example-3).
|
|
211
|
+
|
|
212
|
+
[^fc-revert]: FullCalendar's [`eventDrop`](https://fullcalendar.io/docs/eventDrop), whose `revert()` is "useful if an ajax call should fail".
|
|
213
|
+
|
|
214
|
+
[^fc-a11y]: FullCalendar's [accessibility](https://fullcalendar.io/docs/accessibility), [`eventInteractive`](https://fullcalendar.io/docs/eventInteractive) and [hints](https://fullcalendar.io/docs/hints) docs, [fullcalendar#6527](https://github.com/fullcalendar/fullcalendar/issues/6527), "ARIA grid, roving tabindex", the [upgrade notes for 7.0](https://fullcalendar.io/docs/upgrading-from-v6), and its [CI workflows](https://github.com/fullcalendar/fullcalendar/tree/main/.github/workflows).
|
|
215
|
+
|
|
216
|
+
[^rbc-a11y]: react-big-calendar's [`TimeGridEvent.js`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/TimeGridEvent.js#L55-L61) gives time grid events a `tabIndex`, and [`EventCell.js`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/EventCell.js#L62-L74) doesn't. Open issues [#2538](https://github.com/bigcalendar/react-big-calendar/issues/2538) and [#2045](https://github.com/bigcalendar/react-big-calendar/issues/2045). Its [`package.json`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/package.json) has no axe.
|
|
217
|
+
|
|
218
|
+
[^fc-rtl]: FullCalendar's [`direction`](https://fullcalendar.io/docs/direction).
|
|
219
|
+
|
|
220
|
+
[^rbc-rtl]: react-big-calendar's [`rtl`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/Calendar.js#L560) prop.
|
|
221
|
+
|
|
222
|
+
[^fc-time]: FullCalendar's [date library](https://fullcalendar.io/docs/date-library), [temporal-polyfill](https://fullcalendar.io/docs/temporal-polyfill) and [`timeZone`](https://fullcalendar.io/docs/timeZone) docs.
|
|
223
|
+
|
|
224
|
+
[^rbc-time]: react-big-calendar's [dates guide](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/stories/guides/Dates.mdx#L8-L10), its [localizers](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/index.js#L11-L16), its [time zones guide](https://bigcalendar.github.io/react-big-calendar/?path=/docs/guides-timezones--docs), and the [date-fns localizer](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/localizers/date-fns.js).
|
|
225
|
+
|
|
226
|
+
[^fc-dst]: FullCalendar's [7.1.0 release notes](https://github.com/fullcalendar/fullcalendar/releases/tag/v7.1.0): "Timeline view, account for DST in timeslots".
|
|
227
|
+
|
|
228
|
+
[^rbc-dst]: react-big-calendar's [`localizer.js`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/localizer.js) and [`TimeGutter.js`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/TimeGutter.js), and [#2534](https://github.com/bigcalendar/react-big-calendar/issues/2534), a date missing from the month view in March 2024.
|
|
229
|
+
|
|
230
|
+
[^fc-secondary]: [fullcalendar#3964](https://github.com/fullcalendar/fullcalendar/issues/3964), "multiple timeGrid/timeline axis, each with different time zone".
|
|
231
|
+
|
|
232
|
+
[^rbc-secondary]: [#2306](https://github.com/bigcalendar/react-big-calendar/issues/2306), "Support for Displaying Multiple Timezones", closed by a bot in May 2026.
|
|
233
|
+
|
|
234
|
+
[^fc-locale]: FullCalendar's [`locale`](https://fullcalendar.io/docs/locale). `@fullcalendar/react` 7.1.2 ships 79 locale files.
|
|
235
|
+
|
|
236
|
+
[^rbc-locale]: react-big-calendar's [`culture`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/Calendar.js#L658) and [`messages`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/Calendar.js#L861) props.
|
|
237
|
+
|
|
238
|
+
[^fc-rrule]: FullCalendar's [recurring events](https://fullcalendar.io/docs/recurring-events) and [RRule plugin](https://fullcalendar.io/docs/rrule-plugin).
|
|
239
|
+
|
|
240
|
+
[^rbc-recurrence]: [#355](https://github.com/bigcalendar/react-big-calendar/issues/355): "I don't want to provide such functionality in the library".
|
|
241
|
+
|
|
242
|
+
[^fc-ics]: FullCalendar's [iCalendar plugin](https://fullcalendar.io/docs/icalendar).
|
|
243
|
+
|
|
244
|
+
[^fc-hours]: FullCalendar's [`businessHours`](https://fullcalendar.io/docs/businessHours), [business hours per resource](https://fullcalendar.io/docs/businessHours-per-resource), [`eventConstraint`](https://fullcalendar.io/docs/eventConstraint), [`eventOverlap`](https://fullcalendar.io/docs/eventOverlap) and [`selectAllow`](https://fullcalendar.io/docs/selectAllow).
|
|
245
|
+
|
|
246
|
+
[^rbc-hours]: react-big-calendar's [`backgroundEvents`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/Calendar.js#L148-L168), [`slotPropGetter`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/Calendar.js#L577-L586), [`min` and `max`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/Calendar.js#L627-L634), its [time grid](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/src/TimeGrid.js#L256-L258), and [`dayLayoutAlgorithm`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/stories/props/dayLayoutAlgorithm.mdx#L9-L13).
|
|
247
|
+
|
|
248
|
+
[^rbc-state]: react-big-calendar's [drag and drop example](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/stories/demos/exampleCode/dnd.js#L14-L43).
|
|
249
|
+
|
|
250
|
+
[^fc-headless]: [`@full-ui/headless-calendar`](https://www.npmjs.com/package/@full-ui/headless-calendar) on npm.
|
|
251
|
+
|
|
252
|
+
[^fc-frameworks]: FullCalendar's [React](https://fullcalendar.io/docs/react), [Vue](https://fullcalendar.io/docs/vue), [Angular](https://fullcalendar.io/docs/angular) and [web component](https://fullcalendar.io/docs/web-component) docs, and the [upgrade notes for 7.0](https://fullcalendar.io/docs/upgrading-from-v6).
|
|
253
|
+
|
|
254
|
+
[^rbc-react]: react-big-calendar's [`package.json`](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/package.json).
|
|
255
|
+
|
|
256
|
+
[^fc-react]: FullCalendar's [React docs](https://fullcalendar.io/docs/react): "server-side rendering and StrictMode work".
|
|
257
|
+
|
|
258
|
+
[^rbc-ssr]: [#2436](https://github.com/bigcalendar/react-big-calendar/issues/2436) and [#2631](https://github.com/bigcalendar/react-big-calendar/issues/2631).
|
|
259
|
+
|
|
260
|
+
[^fc-shadcn]: FullCalendar's [shadcn/ui docs](https://fullcalendar.io/docs/shadcn) and its registry item [`monarch-event-calendar`](https://shadcn-registry.fullcalendar.io/monarch-event-calendar.json).
|
|
261
|
+
|
|
262
|
+
[^fc-themes]: FullCalendar's [stock themes](https://fullcalendar.io/docs/stock-themes) and [custom themes](https://fullcalendar.io/docs/custom-themes).
|
|
263
|
+
|
|
264
|
+
[^rbc-theme]: react-big-calendar's [readme](https://github.com/bigcalendar/react-big-calendar/blob/v1.20.0/README.md#L153-L165).
|
|
265
|
+
|
|
266
|
+
[^rbc-types]: [`@types/react-big-calendar`](https://www.npmjs.com/package/@types/react-big-calendar) on npm.
|
|
267
|
+
|
|
268
|
+
[^fc-virtual]: FullCalendar's [virtual rendering](https://fullcalendar.io/docs/virtual-rendering) and [`virtualization`](https://fullcalendar.io/docs/virtualization).
|
|
269
|
+
|
|
270
|
+
[^rbc-perf]: [#2752](https://github.com/bigcalendar/react-big-calendar/issues/2752) and [#2068](https://github.com/bigcalendar/react-big-calendar/issues/2068), closed by a bot in May 2026, and the open fix [#2753](https://github.com/bigcalendar/react-big-calendar/pull/2753).
|
|
271
|
+
|
|
272
|
+
[^fc-maturity]: FullCalendar's [GitHub repository](https://github.com/fullcalendar/fullcalendar), [contributors](https://github.com/fullcalendar/fullcalendar/graphs/contributors) and [releases](https://github.com/fullcalendar/fullcalendar/releases).
|
|
273
|
+
|
|
274
|
+
[^rbc-maturity]: react-big-calendar's [GitHub repository](https://github.com/bigcalendar/react-big-calendar), [contributors](https://github.com/bigcalendar/react-big-calendar/graphs/contributors), [releases](https://github.com/bigcalendar/react-big-calendar/releases) and [npm versions](https://www.npmjs.com/package/react-big-calendar?activeTab=versions).
|
|
275
|
+
|
|
276
|
+
[^fc-downloads]: npm's [download counts](https://api.npmjs.org/downloads/point/2026-10-06:2026-10-12/@fullcalendar/react) for October 6 to 12, 2026.
|
|
277
|
+
|
|
278
|
+
[^rbc-downloads]: npm's [download counts](https://api.npmjs.org/downloads/point/2026-10-06:2026-10-12/react-big-calendar) for October 6 to 12, 2026.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Anatomy
|
|
2
|
+
|
|
3
|
+
The parts a calendar is built from, and their names in code.
|
|
4
|
+
|
|
5
|
+
Source: https://time.molten.sh/docs/react/concepts/anatomy
|
|
6
|
+
|
|
7
|
+
A calendar is made of the parts your `createCalendar` factory returns, such as `Calendar.Toolbar`,
|
|
8
|
+
and a few components from the registry. The diagram labels each part with its name in code, and the
|
|
9
|
+
code below it puts the same parts together.
|
|
10
|
+
|
|
11
|
+
> Diagram: see it at https://time.molten.sh/docs/react/concepts/anatomy
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<Calendar.Root
|
|
15
|
+
events={meetings}
|
|
16
|
+
defaultAnchorDate={today}
|
|
17
|
+
defaultTimeZone="Europe/Berlin"
|
|
18
|
+
locale="en-US"
|
|
19
|
+
weekRules={weekRules}
|
|
20
|
+
>
|
|
21
|
+
<Calendar.Frame>
|
|
22
|
+
<Calendar.Toolbar>
|
|
23
|
+
<Calendar.TodayTrigger>Today</Calendar.TodayTrigger>
|
|
24
|
+
<Calendar.PreviousTrigger aria-label="Previous period" />
|
|
25
|
+
<Calendar.NextTrigger aria-label="Next period" />
|
|
26
|
+
<Calendar.Title />
|
|
27
|
+
<ViewSwitcher value={view} onValueChange={setView} options={viewOptions} />
|
|
28
|
+
</Calendar.Toolbar>
|
|
29
|
+
<aside>
|
|
30
|
+
<MiniMonth
|
|
31
|
+
locale="en-US"
|
|
32
|
+
selectedDate={anchorDate}
|
|
33
|
+
onSelectDate={setAnchorDate}
|
|
34
|
+
today={today}
|
|
35
|
+
weekStartsOn={1}
|
|
36
|
+
/>
|
|
37
|
+
</aside>
|
|
38
|
+
<Calendar.Viewport>
|
|
39
|
+
<Calendar.ActiveView />
|
|
40
|
+
</Calendar.Viewport>
|
|
41
|
+
</Calendar.Frame>
|
|
42
|
+
</Calendar.Root>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- **`Root`** holds the calendar's state and renders no element of its own. Every part and hook
|
|
46
|
+
works anywhere inside it.
|
|
47
|
+
- **`Frame`, `Toolbar`, `Title`, `Viewport`,** and the three triggers each render one element with a
|
|
48
|
+
`data-calendar-part` attribute, such as `data-calendar-part="today-trigger"`, for styling. The
|
|
49
|
+
[component reference](../api/components.md#components) lists them.
|
|
50
|
+
- **`ActiveView`** renders the active view's Renderer inside the viewport.
|
|
51
|
+
- **`ViewSwitcher`** and **`MiniMonth`** come from `registry/calendar`. They're plain components:
|
|
52
|
+
you connect them to the calendar with `setView`, `setAnchorDate`, and the `view` and
|
|
53
|
+
`anchorDate` state. `Calendar.ViewSwitcher` is an unstyled `<select>` you can use instead.
|
|
54
|
+
|
|
55
|
+
The registry's `CalendarToolbar` renders the toolbar parts above, styled, and puts its children at
|
|
56
|
+
the end. The [Quick start](../quick-start.md) uses it:
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
<CalendarToolbar calendar={Calendar}>
|
|
60
|
+
<ViewSwitcher value={view} onValueChange={setView} options={viewOptions} />
|
|
61
|
+
</CalendarToolbar>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Views
|
|
65
|
+
|
|
66
|
+
`ActiveView` draws the rest. Each built-in view has its own anatomy:
|
|
67
|
+
|
|
68
|
+
- [Week and day](../views/week-and-day.md#anatomy): Day headers, the all-day row, the time gutter, columns, and events.
|
|
69
|
+
- [Month](../views/month.md#anatomy): Week rows, day cells, event chips, multi-day bars, and +N more.
|
|
70
|
+
- [Agenda](../views/agenda.md#anatomy): Day groups, items, the All day badge, and the empty state.
|
|
71
|
+
- [Year](../views/year.md#anatomy): Twelve month grids and a day's popover.
|
|
72
|
+
- [Resource columns](../views/resource-columns.md#anatomy): Resource headers, the time gutter, and a column per resource.
|
|
73
|
+
- [Resource timeline](../views/resource-timeline.md#anatomy): The time header, resource rows, and event bars.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Events and adapters
|
|
2
|
+
|
|
3
|
+
How Time reads your event records, and what happens when one is invalid.
|
|
4
|
+
|
|
5
|
+
Source: https://time.molten.sh/docs/react/concepts/events
|
|
6
|
+
|
|
7
|
+
Time has no event class of its own. You pass an array of your own records to `Root`, and an
|
|
8
|
+
**adapter** tells Time how to read each one: its ID, title, time range, and the resources it belongs
|
|
9
|
+
to.
|
|
10
|
+
|
|
11
|
+
```tsx title="bookings.tsx"
|
|
12
|
+
import { createCalendar, defineEventAdapter, type CalendarDiagnostic } from "@moltenship/calendar";
|
|
13
|
+
|
|
14
|
+
interface Booking {
|
|
15
|
+
readonly id: `booking-${number}`;
|
|
16
|
+
readonly roomIds: readonly `room-${number}`[];
|
|
17
|
+
readonly summary: string;
|
|
18
|
+
readonly startsAt: Temporal.Instant;
|
|
19
|
+
readonly endsAt: Temporal.Instant;
|
|
20
|
+
readonly updatedAt: string;
|
|
21
|
+
readonly locked: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface Room {
|
|
25
|
+
readonly id: `room-${number}`;
|
|
26
|
+
readonly name: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const bookingAdapter = defineEventAdapter<Booking>()({
|
|
30
|
+
getId: (booking) => booking.id,
|
|
31
|
+
getTitle: (booking) => booking.summary,
|
|
32
|
+
getInterval: (booking) => ({ kind: "timed", start: booking.startsAt, end: booking.endsAt }),
|
|
33
|
+
getResourceIds: (booking) => booking.roomIds,
|
|
34
|
+
getRevision: (booking) => booking.updatedAt,
|
|
35
|
+
isReadOnly: (booking) => booking.locked,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const BookingCalendar = createCalendar<Booking, Room>()({ eventAdapter: bookingAdapter });
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`defineEventAdapter<Booking>()` is called twice on purpose. The first call fixes the record type,
|
|
42
|
+
and the second infers the ID types from your accessors. Here `booking-${number}` stays
|
|
43
|
+
`booking-${number}` everywhere Time hands an ID back to you, so you never cast.
|
|
44
|
+
|
|
45
|
+
`getRevision`, `isReadOnly` and `isBusy` are optional. The [adapter reference](../api/events.md#adapter)
|
|
46
|
+
lists every field.
|
|
47
|
+
|
|
48
|
+
## Time ranges
|
|
49
|
+
|
|
50
|
+
`getInterval` returns one of three kinds of range. Pick the one that matches what the event means:
|
|
51
|
+
|
|
52
|
+
| `kind` | `start` and `end` | Use it for |
|
|
53
|
+
| ------------ | ------------------------ | --------------------------------------------------------------- |
|
|
54
|
+
| `"timed"` | `Temporal.Instant` | Meetings and calls: exact moments, shown in the calendar's zone |
|
|
55
|
+
| `"all-day"` | `Temporal.PlainDate` | Holidays and vacations: whole dates, the same in every zone |
|
|
56
|
+
| `"floating"` | `Temporal.PlainDateTime` | Wall-clock times with no zone, like "gym at 7:00" |
|
|
57
|
+
|
|
58
|
+
The end is always exclusive. A one-day all-day event on October 8 has `end` set to October 9.
|
|
59
|
+
[Time and time zones](./time.md) covers this in detail.
|
|
60
|
+
|
|
61
|
+
## IDs
|
|
62
|
+
|
|
63
|
+
Event and resource IDs are non-empty strings or finite numbers. To check untrusted input before
|
|
64
|
+
it reaches the calendar, use `isEventId` and `isResourceId`:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { isEventId } from "@moltenship/calendar";
|
|
68
|
+
|
|
69
|
+
isEventId("booking-12"); // true
|
|
70
|
+
isEventId(""); // false
|
|
71
|
+
isEventId(Number.NaN); // false
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Resources
|
|
75
|
+
|
|
76
|
+
Resources are what events are assigned to: rooms, people, equipment. Pass your own resource records
|
|
77
|
+
(anything with an `id`) to `Root` as `resources`, and return their IDs from `getResourceIds`. An
|
|
78
|
+
event can belong to no resource, one, or several.
|
|
79
|
+
|
|
80
|
+
Views can then filter by resource with `snapshot.eventsForResource(roomId)` or
|
|
81
|
+
`snapshot.queryTimed(range, { resourceIds: [roomId] })`. See [snapshot queries](../api/events.md#queries).
|
|
82
|
+
|
|
83
|
+
## Changing events
|
|
84
|
+
|
|
85
|
+
Time never edits, saves, or fetches your events. When your data changes, update your own state and
|
|
86
|
+
pass a new array. To fetch only the dates on screen, load the `loadRange` that [`onVisibleRangeChange`](../views/scrolling.md#loading-events-as-you-scroll) reports.
|
|
87
|
+
|
|
88
|
+
Treat your records as immutable: change a record by replacing it with a new object. Time compares
|
|
89
|
+
the array item by item, so a new array with the same records in the same order counts as unchanged,
|
|
90
|
+
even if you build it inline with `filter` or `map`. When the array does change, Time reads every record again
|
|
91
|
+
through the adapter; if every record comes out the same, in the same order, it keeps its interval indexes. With
|
|
92
|
+
`getRevision`, a record whose revision is unchanged is skipped after `getId` and `getRevision`. The [performance guide](../guides/performance.md)
|
|
93
|
+
explains how to make the most of that.
|
|
94
|
+
|
|
95
|
+
## Events from an external store
|
|
96
|
+
|
|
97
|
+
`events` also takes a **source**: an object with `getSnapshot`, `getServerSnapshot` and
|
|
98
|
+
`subscribe`, the shape React's `useSyncExternalStore` reads. Use one when your events live outside
|
|
99
|
+
React and change often, as in a store a websocket or a sync engine updates, or a Zustand-like
|
|
100
|
+
store. `Root` subscribes to the source itself, so an update renders the calendar, not the component
|
|
101
|
+
that renders `Root`. With a Zustand store:
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import type { CalendarEventSource } from "@moltenship/calendar";
|
|
105
|
+
|
|
106
|
+
// At module scope, so the source stays the same object.
|
|
107
|
+
const bookingSource: CalendarEventSource<Booking> = {
|
|
108
|
+
getSnapshot: () => useBookings.getState().bookings,
|
|
109
|
+
getServerSnapshot: () => useBookings.getInitialState().bookings,
|
|
110
|
+
subscribe: useBookings.subscribe,
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
<BookingCalendar.Root events={bookingSource} {...otherProps} />;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
- `getSnapshot` returns the same array until the events change. Don't filter or map inside it: a
|
|
117
|
+
new array on every call looks like a change every time, and React renders in a loop.
|
|
118
|
+
- `getServerSnapshot` returns the events the server rendered with. The server and hydration read
|
|
119
|
+
it, then `Root` shows `getSnapshot`'s events and subscribes. Without server rendering, return the
|
|
120
|
+
store's initial events.
|
|
121
|
+
- Keep the source stable, at module scope or in `useState`. A new source object subscribes again.
|
|
122
|
+
|
|
123
|
+
Everything else works as with an array: records are compared item by item and read through your
|
|
124
|
+
adapter, a saved change stays [pending](../interactions.md#pending-changes) until the source's
|
|
125
|
+
events next change, and you can switch between an array and a source. A busy source changes
|
|
126
|
+
often, so write a saved change into the store before your handler's promise resolves: otherwise
|
|
127
|
+
the source's next update, even one about other events, decides where the event is. React renders a source's
|
|
128
|
+
updates right away, as it does for any external store; to update in a transition, keep the events
|
|
129
|
+
in state and pass the array.
|
|
130
|
+
|
|
131
|
+
## Invalid records
|
|
132
|
+
|
|
133
|
+
By default, an invalid record is skipped and reported. The rest of the calendar keeps working.
|
|
134
|
+
Reasons include a missing or duplicate ID, an end that isn't after the start, a range of the wrong
|
|
135
|
+
Temporal type, or an adapter function that throws.
|
|
136
|
+
|
|
137
|
+
Reports show up in `meta.diagnostics` and in the `onDiagnosticsChange` callback on `Root`:
|
|
138
|
+
|
|
139
|
+
```tsx title="bookings.tsx"
|
|
140
|
+
export function reportDiagnostics(
|
|
141
|
+
diagnostics: readonly CalendarDiagnostic<Booking, Booking["id"]>[],
|
|
142
|
+
) {
|
|
143
|
+
for (const diagnostic of diagnostics) {
|
|
144
|
+
if (diagnostic.code === "invalid-event") {
|
|
145
|
+
console.warn(`Skipped event #${diagnostic.issue.index}: ${diagnostic.issue.code}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Pass `reportDiagnostics` as `onDiagnosticsChange`. Time calls it after mount and again whenever the
|
|
153
|
+
list changes; an inline function works too.
|
|
154
|
+
|
|
155
|
+
To reject bad input instead, pass `invalidEventPolicy: "throw"` to `createCalendar`.
|
|
156
|
+
Time then throws an `InvalidCalendarEventSnapshotError` during render, with every problem listed on
|
|
157
|
+
its `issues` property. Catch it with an error boundary.
|
|
158
|
+
|
|
159
|
+
## Records in Time's own shape
|
|
160
|
+
|
|
161
|
+
If you're starting from scratch, you can store events in Time's built-in shape (`CalendarEvent`: an
|
|
162
|
+
`id`, `title`, `kind`, `start`, `end`, optional `resourceIds`, and your own `data`) and use
|
|
163
|
+
`createCanonicalEventAdapter()` instead of writing an adapter.
|