@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.
Files changed (78) hide show
  1. package/README.md +27 -6
  2. package/dist/index.d.mts +3 -3
  3. package/dist/index.mjs +2 -2
  4. package/docs/accessibility.md +305 -0
  5. package/docs/agents/changes.md +449 -0
  6. package/docs/agents/coding-agents.md +116 -0
  7. package/docs/agents/connect.md +444 -0
  8. package/docs/agents/deleting.md +296 -0
  9. package/docs/agents/reference.md +511 -0
  10. package/docs/agents/server.md +317 -0
  11. package/docs/agents/webmcp.md +153 -0
  12. package/docs/agents.md +355 -0
  13. package/docs/annotations.md +198 -0
  14. package/docs/api/changes.md +264 -0
  15. package/docs/api/components.md +245 -0
  16. package/docs/api/dnd-kit.md +265 -0
  17. package/docs/api/events.md +153 -0
  18. package/docs/api/primitives.md +218 -0
  19. package/docs/api/store.md +92 -0
  20. package/docs/api.md +57 -0
  21. package/docs/availability.md +576 -0
  22. package/docs/comparison.md +278 -0
  23. package/docs/concepts/anatomy.md +73 -0
  24. package/docs/concepts/events.md +163 -0
  25. package/docs/concepts/how-it-works.md +112 -0
  26. package/docs/concepts/state.md +244 -0
  27. package/docs/concepts/time.md +168 -0
  28. package/docs/customization.md +271 -0
  29. package/docs/frameworks.md +116 -0
  30. package/docs/guides/dnd-kit.md +333 -0
  31. package/docs/guides/google-calendar-sync.md +1246 -0
  32. package/docs/guides/google-calendar.md +367 -0
  33. package/docs/guides/motion.md +414 -0
  34. package/docs/guides/nextjs-app-router.md +630 -0
  35. package/docs/guides/nextjs.md +149 -0
  36. package/docs/guides/performance.md +103 -0
  37. package/docs/guides/tanstack-query.md +485 -0
  38. package/docs/ics/feed.md +484 -0
  39. package/docs/ics/import.md +183 -0
  40. package/docs/ics/reference.md +482 -0
  41. package/docs/ics.md +142 -0
  42. package/docs/index.md +149 -0
  43. package/docs/installation.md +209 -0
  44. package/docs/interactions.md +441 -0
  45. package/docs/llms.txt +99 -0
  46. package/docs/migrating-to-2.md +497 -0
  47. package/docs/quick-start.md +163 -0
  48. package/docs/recurrence/calendar.md +598 -0
  49. package/docs/recurrence/model.md +128 -0
  50. package/docs/recurrence/reference.md +547 -0
  51. package/docs/recurrence.md +122 -0
  52. package/docs/stylex.md +290 -0
  53. package/docs/temporal/daylight-saving-time.md +172 -0
  54. package/docs/temporal/month-grid.md +119 -0
  55. package/docs/temporal/reference.md +167 -0
  56. package/docs/temporal.md +105 -0
  57. package/docs/testing.md +600 -0
  58. package/docs/theme-builder.md +82 -0
  59. package/docs/theming.md +275 -0
  60. package/docs/undo-redo.md +347 -0
  61. package/docs/views/agenda.md +222 -0
  62. package/docs/views/custom-views.md +195 -0
  63. package/docs/views/month.md +110 -0
  64. package/docs/views/resource-columns.md +265 -0
  65. package/docs/views/resource-timeline.md +226 -0
  66. package/docs/views/scrolling.md +193 -0
  67. package/docs/views/week-and-day.md +258 -0
  68. package/docs/views/year.md +138 -0
  69. package/docs/views.md +69 -0
  70. package/package.json +42 -14
  71. package/skills/moltenship-time/SKILL.md +77 -0
  72. package/skills/moltenship-time/references/agent-ready.md +272 -0
  73. package/skills/moltenship-time/references/changes.md +188 -0
  74. package/skills/moltenship-time/references/compose.md +175 -0
  75. package/skills/moltenship-time/references/mistakes.md +100 -0
  76. package/skills/moltenship-time/references/solid.md +213 -0
  77. package/skills/moltenship-time/references/state.md +129 -0
  78. package/skills/moltenship-time/references/testing.md +176 -0
@@ -0,0 +1,112 @@
1
+ # How it works
2
+
3
+ The packages, which of them React and Solid share, and how your events become a rendered view.
4
+
5
+ Source: https://time.molten.sh/docs/react/concepts/how-it-works
6
+
7
+ ## Packages
8
+
9
+ Time has three layers. The engine and the calendar import no UI framework, and an integration
10
+ renders them in one:
11
+
12
+ ```text
13
+ integration @moltenship/calendar (React) @moltenship/calendar-solid (Solid)
14
+ calendar @moltenship/calendar-primitives state, actions, what an agent can call
15
+ engine @moltenship/calendar-core adapters, validation, snapshots, queries, changes
16
+ @moltenship/calendar-temporal ranges, day boundaries, DST helpers
17
+ ```
18
+
19
+ A React app imports one package, which re-exports the React integration and the layers under it:
20
+
21
+ ```text
22
+ @moltenship/calendar what a React app imports: everything below
23
+ ├── @moltenship/calendar-react the React integration: Root, components, hooks
24
+ │ └── @moltenship/calendar-primitives the calendar without a framework: state, actions, agents
25
+ ├── @moltenship/calendar-dnd drag, resize, and create inside views
26
+ ├── @moltenship/calendar-core adapters, validation, snapshots, queries, changes
27
+ └── @moltenship/calendar-temporal ranges, day boundaries, DST helpers
28
+ ```
29
+
30
+ A Solid app imports `@moltenship/calendar-solid` and `@moltenship/calendar-core`. The Solid
31
+ integration has [docs of its own](https://time.molten.sh/docs/solid.md), and
32
+ [React and Solid](../frameworks.md) lists what it has.
33
+
34
+ `calendar-dnd` builds on `calendar-core`, which builds on `calendar-temporal`, and `calendar-react`
35
+ builds on all three and on `calendar-primitives`.
36
+ `calendar-core` and `calendar-temporal` don't use React or the DOM, so they also run on a server
37
+ or in a worker.
38
+
39
+ Since 2.0 the calendar itself is written once, without a framework, in
40
+ `@moltenship/calendar-primitives`: the state, the actions, the pipeline from your events to a
41
+ view's projection, and what the calendar tells an [AI agent](../agents.md). It's a
42
+ [ui-sdk](https://ui-sdk.dev) primitive, and `calendar-react` renders it with `@ui-sdk/react`. That
43
+ is why `@ui-sdk/core` and `@ui-sdk/react` are peer dependencies, and how
44
+ `@moltenship/calendar-solid` renders the same calendar in SolidJS 2. Dates, time zones,
45
+ recurrence, layouts and policies stay in the calendar's own engine; ui-sdk's date components
46
+ aren't used.
47
+
48
+ Two more packages stand apart from `@moltenship/calendar`: `@moltenship/calendar-recurrence` expands
49
+ recurring events into ordinary events (it builds on core, Temporal and `ics`), and `@moltenship/ics`
50
+ parses iCalendar text with no dependencies.
51
+
52
+ | Package | Use it when |
53
+ | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
54
+ | `@moltenship/calendar` | Your app is on React. It includes `calendar-core`, `calendar-temporal`, `calendar-react` and `calendar-dnd`. |
55
+ | `@moltenship/calendar-core` | You validate or query events in code that loads no framework. |
56
+ | `@moltenship/calendar-temporal` | You only need the date and time zone helpers. |
57
+ | `@moltenship/calendar-react` | Rarely. `@moltenship/calendar` already includes everything in it. |
58
+ | `@moltenship/calendar-primitives` | You write a framework integration, or want the agent types. See [Primitives](../api/primitives.md). |
59
+ | `@moltenship/calendar-solid` | Your app is on SolidJS 2. It includes `calendar-core`, `calendar-temporal` and the pointer helpers of `calendar-dnd`. See the [Solid docs](https://time.molten.sh/docs/solid.md). |
60
+ | `@moltenship/calendar-recurrence` | Your events repeat. See [Recurring events](../recurrence/model.md). |
61
+ | `@moltenship/ics` | You read iCalendar feeds or files. See [ICS](../ics/reference.md). |
62
+
63
+ `@moltenship/calendar` has no `"use client"` directive of its own, so a Server Component can import
64
+ its core and Temporal helpers. The React parts and the pointer layer keep their client boundary.
65
+
66
+ Import from the package name only. The packages export nothing else besides `./package.json`, so a
67
+ path such as
68
+ `@moltenship/calendar-core/src/events` doesn't resolve.
69
+
70
+ ## From events to the screen
71
+
72
+ 1. You pass `events` to `Root`.
73
+ 2. `Root` runs each record through your adapter, validates it, and builds a **snapshot**: a frozen,
74
+ indexed copy of your events.
75
+ 3. `Root` asks the active view's strategy for the visible dates, then calls its `project` function
76
+ with the snapshot. The result is the view's **projection**: the events it needs, in the shape it
77
+ needs.
78
+ 4. `ActiveView` renders the view's `Renderer` with that projection.
79
+ 5. Buttons and your own controls call actions such as `navigateNext` or `setView`. The calendar
80
+ updates uncontrolled state itself and sends controlled changes to your handlers. A new date or
81
+ view means a new range and a new projection.
82
+ 6. An [agent](../agents.md) calls the same actions through ui-sdk's agent bridge, if your app
83
+ creates one. Its changes reach the same handlers and policies, marked as an agent's.
84
+
85
+ Steps 2 and 3 only run again when their inputs change. A new array with the same records in the same
86
+ order reuses the snapshot. A changed array is read again through the adapter, except records with an
87
+ unchanged `getRevision` value; if every record comes out the same, in the same order, the interval indexes are kept.
88
+
89
+ ## Using the engine without a framework
90
+
91
+ Snapshots work anywhere. This finds the meetings in a time range using `calendar-core` and
92
+ `calendar-temporal` directly:
93
+
94
+ ```ts
95
+ import { createEventSnapshotCache } from "@moltenship/calendar-core";
96
+ import { instantInterval } from "@moltenship/calendar-temporal";
97
+
98
+ const snapshots = createEventSnapshotCache(eventAdapter);
99
+ const snapshot = snapshots.getSnapshot(meetings);
100
+
101
+ const morning = snapshot.queryTimed(
102
+ instantInterval(
103
+ Temporal.Instant.from("2026-10-08T06:00:00Z"),
104
+ Temporal.Instant.from("2026-10-08T10:00:00Z"),
105
+ ),
106
+ );
107
+
108
+ morning.map((meeting) => meeting.title); // ["Standup"]
109
+ ```
110
+
111
+ `eventAdapter` and `meetings` are the ones from the [Quick start](../quick-start.md). The
112
+ [snapshot reference](../api/events.md#snapshots) lists every query.
@@ -0,0 +1,244 @@
1
+ # State
2
+
3
+ Let the calendar own its state, or control it from your app, one value at a time.
4
+
5
+ Source: https://time.molten.sh/docs/react/concepts/state
6
+
7
+ `Root` keeps six values:
8
+
9
+ | Value | Type | Meaning |
10
+ | --------------------- | ---------------------- | ------------------------------------------- |
11
+ | `view` | one of your view names | The active view |
12
+ | `anchorDate` | `Temporal.PlainDate` | The date the visible range is built around |
13
+ | `timeZone` | `string` (IANA name) | The zone timed events are shown in |
14
+ | `selection` | your type, or `null` | What the user selected |
15
+ | `focus` | your type, or `null` | What has keyboard focus inside the calendar |
16
+ | `expandedResourceIds` | array of resource IDs | Which resource groups are expanded |
17
+
18
+ Each value can be **uncontrolled** (the calendar owns it) or **controlled** (your app owns it),
19
+ independently of the others.
20
+
21
+ ## Uncontrolled
22
+
23
+ Pass a `default` prop and the calendar manages the value from then on. Defaults are read once, when
24
+ `Root` mounts.
25
+
26
+ ```tsx
27
+ <Calendar.Root
28
+ events={meetings}
29
+ defaultView="day"
30
+ defaultAnchorDate={Temporal.PlainDate.from("2026-10-08")}
31
+ defaultTimeZone="Europe/Berlin"
32
+ locale="en-US"
33
+ weekRules={weekRules}
34
+ >
35
+ <Calendar.ActiveView />
36
+ </Calendar.Root>
37
+ ```
38
+
39
+ ## Controlled
40
+
41
+ Pass the value and a change handler. The calendar never changes a controlled value itself. When the
42
+ user clicks Next, it calls your handler with the new value, and you decide whether to store it.
43
+
44
+ This example controls the date so a date input outside the calendar stays in sync. It uses the
45
+ `Calendar` from the [Quick start](../quick-start.md).
46
+
47
+ ```tsx title="controlled-state.tsx"
48
+ export function ControlledCalendar() {
49
+ const [anchorDate, setAnchorDate] = useState(() => Temporal.PlainDate.from("2026-10-08"));
50
+
51
+ return (
52
+ <>
53
+ <input
54
+ type="date"
55
+ value={anchorDate.toString()}
56
+ onChange={(event) => {
57
+ if (event.currentTarget.value) {
58
+ setAnchorDate(Temporal.PlainDate.from(event.currentTarget.value));
59
+ }
60
+ }}
61
+ />
62
+ <Calendar.Root
63
+ events={meetings}
64
+ anchorDate={anchorDate}
65
+ onAnchorDateChange={setAnchorDate}
66
+ defaultTimeZone="Europe/Berlin"
67
+ locale="en-US"
68
+ weekRules={weekRules}
69
+ >
70
+ <Calendar.PreviousTrigger>Previous</Calendar.PreviousTrigger>
71
+ <Calendar.NextTrigger>Next</Calendar.NextTrigger>
72
+ <NextWeekButton />
73
+ <Calendar.ActiveView />
74
+ </Calendar.Root>
75
+ </>
76
+ );
77
+ }
78
+ ```
79
+
80
+ The props follow one pattern:
81
+
82
+ | Uncontrolled | Controlled | Handler |
83
+ | ---------------------------- | --------------------- | ----------------------------- |
84
+ | `defaultView` | `view` | `onViewChange` |
85
+ | `defaultAnchorDate` | `anchorDate` | `onAnchorDateChange` |
86
+ | `defaultTimeZone` | `timeZone` | `onTimeZoneChange` |
87
+ | `defaultSelection` | `selection` | `onSelectionChange` |
88
+ | `defaultFocus` | `focus` | `onFocusChange` |
89
+ | `defaultExpandedResourceIds` | `expandedResourceIds` | `onExpandedResourceIdsChange` |
90
+
91
+ A few rules:
92
+
93
+ - `undefined` means uncontrolled. To control `selection` or `focus` with nothing selected, pass
94
+ `null`.
95
+ - Handlers also run for uncontrolled values, after the calendar updates them. The second argument
96
+ says what changed, why, and who asked. See [what a handler hears](#what-a-handler-hears).
97
+ - If you haven't applied a change the calendar asked for, the handler also hears a later request
98
+ for the value you have. For example, Today after a scroll you deferred. Apply the latest value
99
+ you were given, and you'll drop the earlier change.
100
+ - `Root` needs a date, a time zone, and a view on its first render. The view can come from
101
+ `defaultView`, `view`, or the first registered view. If one is missing, `Root` throws
102
+ `calendar-root-requires-anchor-date`, `calendar-root-requires-time-zone`, or
103
+ `calendar-root-requires-view`.
104
+
105
+ ## What a handler hears
106
+
107
+ Every change handler gets the new value and a detail:
108
+
109
+ | Field | Type | Meaning |
110
+ | ------------ | ------------------ | ----------------------------------------------------------------------------- |
111
+ | `slice` | `string` | Which value changed, such as `"view"` or `"anchorDate"` |
112
+ | `previous` | the value's type | The value before the change |
113
+ | `controlled` | `boolean` | Whether a prop controls the value |
114
+ | `reason` | `string` | Why it changed. See below |
115
+ | `source` | `string` | Who caused it. See below |
116
+ | `event` | `Event`, or absent | The DOM event behind it, such as a button's click. Absent for code and agents |
117
+ | `cancel()` | function | Stops the change. An uncontrolled value goes back to `previous` |
118
+ | `canceled` | `boolean` | Whether `cancel()` was called |
119
+
120
+ `reason` is one of:
121
+
122
+ - `"next-press"`, `"previous-press"` or `"today-press"`: a press of `Calendar.NextTrigger`,
123
+ `Calendar.PreviousTrigger` or `Calendar.TodayTrigger`.
124
+ - `"input-change"`: a choice in `Calendar.ViewSwitcher`.
125
+ - `"keyboard-navigation"`: a key in a view that moves focus or the visible range, such as an
126
+ arrow key or Page Down.
127
+ - `"focus-change"`: focus a person moved onto a cell or an event, by clicking it or tabbing to it.
128
+ - `"resource-toggle"`: a resource expanded or collapsed.
129
+ - `"imperative"`: an action called from code, such as `actions.setView("month")`. It's also the
130
+ reason for anything an [agent](../agents.md) does.
131
+
132
+ `source` is one of `"mouse"`, `"touch"`, `"pen"`, `"keyboard"`, `"virtual"`, `"agent"` or
133
+ `"programmatic"`. `"keyboard"` is a person's keys, on a toolbar button and in a view: arrow-key
134
+ navigation, moving focus and expanding a resource report it. `"virtual"` is a click with no
135
+ pointer or key behind it, which may come from assistive technology. `"agent"` is an AI agent
136
+ acting through the [agent bridge](../agents/connect.md), and anything its step causes.
137
+ `"programmatic"` is your own code.
138
+
139
+ This calendar records how people navigate and keeps agents out of the month view. It uses the
140
+ `Calendar`, `meetings` and `weekRules` from the [Quick start](../quick-start.md):
141
+
142
+ ```tsx title="tracked-calendar.tsx"
143
+ "use client";
144
+
145
+ import { CalendarToolbar } from "@/components/calendar/calendar-toolbar";
146
+
147
+ import { Calendar, meetings, weekRules } from "./calendar";
148
+
149
+ /** Records how the calendar is navigated, and keeps the month view for people. */
150
+ export function TrackedCalendar({ track }: { readonly track: (entry: string) => void }) {
151
+ return (
152
+ <Calendar.Root
153
+ label="Team calendar"
154
+ events={meetings}
155
+ defaultAnchorDate={Temporal.PlainDate.from("2026-10-08")}
156
+ defaultTimeZone="Europe/Berlin"
157
+ locale="en-US"
158
+ weekRules={weekRules}
159
+ onAnchorDateChange={(date, detail) => {
160
+ // "next-press by mouse to 2026-10-15", "imperative by agent to 2026-11-02"
161
+ track(`${detail.reason} by ${detail.source} to ${date.toString()}`);
162
+ }}
163
+ onViewChange={(view, detail) => {
164
+ if (view === "month" && detail.source === "agent") detail.cancel();
165
+ }}
166
+ >
167
+ <Calendar.Frame className="flex h-[640px] flex-col rounded-xl border">
168
+ <CalendarToolbar calendar={Calendar} />
169
+ <Calendar.Viewport className="min-h-0 flex-1">
170
+ <Calendar.ActiveView />
171
+ </Calendar.Viewport>
172
+ </Calendar.Frame>
173
+ </Calendar.Root>
174
+ );
175
+ }
176
+ ```
177
+
178
+ `cancel()` puts an uncontrolled value back as it was. For a controlled value it does nothing you
179
+ couldn't do yourself: the value changes only when you store it.
180
+
181
+ An action you call can say why and who. Pass the DOM event that led to it, and the calendar works
182
+ out the `source`:
183
+
184
+ ```tsx
185
+ <button onClick={(event) => actions.navigateNext({ event: event.nativeEvent })}>Next</button>
186
+ ```
187
+
188
+ Every action takes the same options as its last argument: `{ event?, reason?, source? }`.
189
+ Without them, a call from your code reads `reason: "imperative"` and `source: "programmatic"`.
190
+
191
+ ## Reading and changing state
192
+
193
+ Any component inside `Root` can use the hooks on your calendar:
194
+
195
+ - `useCalendarState()` returns all six values.
196
+ - `useCalendarSelector(selector)` returns one derived value and re-renders only when it changes.
197
+ - `useCalendarActions()` returns `setView`, `setAnchorDate`, `setTimeZone`, `setSelection`,
198
+ `setFocus`, `setExpandedResourceIds`, `navigateNext`, `navigatePrevious`, `navigateToday`,
199
+ `proposeEventChange`, and `checkEventChange`.
200
+ - `useCalendarMeta()` returns everything else: the event snapshot, resources, the environment, the
201
+ active view and the registered views, diagnostics, the instance ID, and element IDs and refs.
202
+ - `useCalendar()` returns `state`, `actions`, and `meta` together.
203
+ - `useVisibleRange()` and `useViewProjection()` return what the active view shows. See
204
+ [Custom views](../views/custom-views.md#reading-the-view-from-other-components).
205
+
206
+ ```tsx title="controlled-state.tsx"
207
+ const selectAnchorDate = (state: CalendarPublicState) => state.anchorDate;
208
+
209
+ function NextWeekButton() {
210
+ const anchorDate = Calendar.useCalendarSelector(selectAnchorDate);
211
+ const actions = Calendar.useCalendarActions();
212
+
213
+ return (
214
+ <button type="button" onClick={() => actions.setAnchorDate(anchorDate.add({ weeks: 1 }))}>
215
+ Skip a week
216
+ </button>
217
+ );
218
+ }
219
+ ```
220
+
221
+ A selector can live outside the component, as above, or inline. Actions called one after another
222
+ build on each other, so `navigateNext()` twice in one click moves two steps, controlled or not.
223
+
224
+ ## Selection and focus types
225
+
226
+ You choose the shape of `selection` and `focus`. Pass their types as the third and fourth type
227
+ arguments of `createCalendar`, after the event and resource types. Time stores the values as they
228
+ are.
229
+
230
+ ```tsx title="selection.tsx"
231
+ type Selection = { readonly eventId: string } | { readonly date: Temporal.PlainDate };
232
+
233
+ const Calendar = createCalendar<Meeting, never, Selection>()({ eventAdapter });
234
+
235
+ export function SelectStandup() {
236
+ const actions = Calendar.useCalendarActions();
237
+
238
+ return (
239
+ <button type="button" onClick={() => actions.setSelection({ eventId: "standup" })}>
240
+ Select standup
241
+ </button>
242
+ );
243
+ }
244
+ ```
@@ -0,0 +1,168 @@
1
+ # Time and time zones
2
+
3
+ Timed, all-day, and floating events, exclusive end times, and daylight saving time.
4
+
5
+ Source: https://time.molten.sh/docs/react/concepts/time
6
+
7
+ Time uses the
8
+ [Temporal API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal)
9
+ for every date and time. There are no `Date` objects or millisecond timestamps in the API, so a
10
+ date never shifts by a day because of a hidden time zone conversion.
11
+
12
+ ## Three kinds of events
13
+
14
+ ```ts
15
+ // A call at 15:00 UTC. Shown at 17:00 in Berlin and 11:00 in New York.
16
+ const call = {
17
+ kind: "timed",
18
+ start: Temporal.Instant.from("2026-10-08T15:00:00Z"),
19
+ end: Temporal.Instant.from("2026-10-08T16:00:00Z"),
20
+ };
21
+
22
+ // A public holiday. October 3 in every time zone.
23
+ const holiday = {
24
+ kind: "all-day",
25
+ start: Temporal.PlainDate.from("2026-10-03"),
26
+ end: Temporal.PlainDate.from("2026-10-04"),
27
+ };
28
+
29
+ // Gym at 07:00, in whatever time zone you're in that day.
30
+ const gym = {
31
+ kind: "floating",
32
+ start: Temporal.PlainDateTime.from("2026-10-08T07:00"),
33
+ end: Temporal.PlainDateTime.from("2026-10-08T08:00"),
34
+ };
35
+ ```
36
+
37
+ - **Timed** events happen at an exact moment. Time converts them to the calendar's time zone for
38
+ display.
39
+ - **All-day** events cover whole dates and ignore time zones.
40
+ - **Floating** events have a wall-clock time but no time zone. They show at the same clock time
41
+ whichever zone the calendar uses.
42
+
43
+ A timed range can also carry `sourceTimeZone`, the zone the event was created in. Time keeps it on
44
+ the event for your views to use; display still uses the calendar's zone.
45
+
46
+ ## End times are exclusive
47
+
48
+ Every range includes its start and excludes its end. This is often written `[start, end)`.
49
+
50
+ - A 9:00–10:00 meeting and a 10:00–11:00 meeting don't overlap.
51
+ - A one-day all-day event on October 3 ends on October 4.
52
+ - An all-day event covering October 3 and 4 ends on October 5.
53
+
54
+ The start must be strictly before the end. Zero-length and reversed ranges are
55
+ [reported as invalid](./events.md#invalid-records).
56
+
57
+ ## The calendar's time zone
58
+
59
+ `Root` takes an IANA time zone name, either as `defaultTimeZone` or as a controlled `timeZone`. Time
60
+ doesn't read the browser's or the server's zone. You choose it, typically from user settings.
61
+
62
+ ```tsx
63
+ const actions = Calendar.useCalendarActions();
64
+
65
+ actions.setTimeZone("America/New_York");
66
+ ```
67
+
68
+ Changing the zone moves timed events to their new local times. All-day and floating events stay
69
+ where they are.
70
+
71
+ To use the visitor's own zone, read `Temporal.Now.timeZoneId()` in the browser. If you render on the
72
+ server, store the zone with the user or pass it from the client after hydration, so the server and
73
+ the browser render the same thing. See [Next.js and server rendering](../guides/nextjs.md).
74
+
75
+ ## Secondary time zones
76
+
77
+ `secondaryTimeZones` on `Root` adds other zones that time grids label their hours in. Events still
78
+ show in the calendar's own zone. Pass IANA names, or `{ timeZone, label }` to name a zone yourself:
79
+
80
+ ```tsx
81
+ <Calendar.Root timeZone="Europe/Berlin" secondaryTimeZones={["Asia/Tokyo"]} />
82
+ ```
83
+
84
+ Time reads each hour line on its own date: it resolves the wall time in the calendar's zone, then
85
+ converts that moment to the other zone. It never adds a fixed offset, so the labels are right on
86
+ the days either zone changes its clocks, and for zones such as Australia/Lord_Howe, whose clocks
87
+ move by 30 minutes. Like `timeZone`, the list is an explicit input, so the server and the browser
88
+ render the same labels. Invalid zones are left out and reported as
89
+ [diagnostics](../api/components.md#diagnostics).
90
+
91
+ A grid has one hour gutter for all its days, so the gutter follows one of them: the first day shown
92
+ on which neither zone changes its clocks. The days whose lines read differently, because a zone
93
+ changed its offset, are listed as shifts: runs of lines, each with how many minutes it differs by.
94
+
95
+ Views get the list as `environment.secondaryTimeZones`. In your own view,
96
+ `timeGridZoneAxis(columns, timeZone)` returns each line's time in another zone and the shifts.
97
+ Pass `{ visible }` when the view renders days beside the ones on screen, so the gutter follows a
98
+ day you can see. `timeGridZoneTimes(column, wallTime, timeZone)` reads one wall time. The
99
+ [week and day views](../views/week-and-day.md#secondary-time-zones) show the zones as extra hour
100
+ columns.
101
+
102
+ ## Daylight saving time
103
+
104
+ Not every day has 24 hours. In Berlin, March 29, 2026 has 23 hours and October 25, 2026 has 25:
105
+
106
+ ```ts
107
+ Temporal.PlainDate.from("2026-03-29").toZonedDateTime("Europe/Berlin").hoursInDay; // 23
108
+ Temporal.PlainDate.from("2026-10-25").toZonedDateTime("Europe/Berlin").hoursInDay; // 25
109
+ ```
110
+
111
+ So some wall-clock times never happen (02:30 on March 29) and some happen twice (02:30 on
112
+ October 25). Temporal's `disambiguation` option decides which moment such a time means:
113
+
114
+ | Value | Skipped time (gap) | Repeated time (fold) |
115
+ | ------------------------ | ------------------------ | --------------------- |
116
+ | `"compatible"` (default) | Moves later by the gap | The earlier one |
117
+ | `"earlier"` | Moves earlier by the gap | The earlier one |
118
+ | `"later"` | Moves later by the gap | The later one |
119
+ | `"reject"` | Throws a `RangeError` | Throws a `RangeError` |
120
+
121
+ ```ts
122
+ Temporal.PlainDateTime.from("2026-03-29T02:30")
123
+ .toZonedDateTime("Europe/Berlin", { disambiguation: "compatible" })
124
+ .toString(); // "2026-03-29T03:30:00+02:00[Europe/Berlin]"
125
+ ```
126
+
127
+ `Root`'s `disambiguation` prop takes the same values (default `"compatible"`) and gives the setting
128
+ to views as `environment.disambiguation`. The built-in views and interactions don't read it; use it
129
+ in your own view when you turn a wall-clock time into an instant. When you build a view, these
130
+ helpers from `@moltenship/calendar` already account for these days:
131
+
132
+ - `zonedDayRange(date, timeZone)` returns the real start and end of a day, 23 or 25 hours long when
133
+ needed.
134
+ - `slotsInZonedDay(date, options)` splits a day into time slots and marks skipped and repeated hours.
135
+ - `resolveZonedWallTime(wallTime, { timeZone, disambiguation })` tells you how a wall-clock time
136
+ resolved, including how far it moved.
137
+
138
+ See the [Temporal helpers reference](../temporal/reference.md).
139
+
140
+ ## The current time
141
+
142
+ Time reads the current time from one of three places, in this order:
143
+
144
+ - `now` on `Root`: a fixed `Temporal.Instant`. Use it when you render on the server, so the server
145
+ and the browser agree on "today".
146
+ - `clock` on `Root`: an object with an `instant()` method, for a value you control, such as a fake
147
+ clock in tests. Define it once at module scope.
148
+ - The system clock, when you pass neither.
149
+
150
+ Without `now`, nothing that depends on the current time renders on the server: a view's `today` is
151
+ `null` and `useNow()` returns `null` until the page has hydrated. The Today button always works; it
152
+ reads the clock when it's clicked.
153
+
154
+ `useNow()` gives a component the current instant, for example to draw a line at the current time. It re-renders every `intervalMs` (one minute by default). This one uses the `Calendar` from the
155
+ [Quick start](../quick-start.md):
156
+
157
+ ```tsx
158
+ import { useNow } from "@moltenship/calendar";
159
+
160
+ function CurrentTime() {
161
+ const now = useNow({ intervalMs: 30_000 });
162
+ const { timeZone } = Calendar.useCalendarState();
163
+ if (now === null) return null;
164
+
165
+ const time = now.toZonedDateTimeISO(timeZone).toPlainTime();
166
+ return <time dateTime={now.toString()}>{time.toString({ smallestUnit: "minute" })}</time>;
167
+ }
168
+ ```