Time zonesCalendar
Display the calendar in any IANA time zone, give individual events a zone of their own, and understand how event times are read, shown and written back.
The calendar displays every view in one time zone, the display zone. Events can carry a zone of their own, and the calendar converts between the two through Intl, with correct daylight saving handling and no date library.
The display zone#
timeZone takes an IANA name such as 'America/New_York', 'Europe/London' or 'Asia/Singapore', or 'UTC'. Without it the calendar uses the browser's zone.
import { createCalendar } from '@birchui/calendar';
const calendar = createCalendar(container, {
view: 'week',
timeZone: 'Europe/Berlin',
locale: 'de-DE',
events,
});
zonePicker.addEventListener('change', () => calendar.update({ timeZone: zonePicker.value }));An unknown name logs a warning and falls back to the browser's zone. Intl.supportedValuesOf('timeZone') lists the names the current browser knows, which is handy for a picker.
The display zone decides where days start and end, what "today" is, where the now indicator sits, how business hours are placed and which times the time grid shows.
How event times are read#
| Input | Example | Meaning |
|---|---|---|
| Date only | '2026-12-25' |
An all-day date. end is exclusive, so a single day needs no end. |
| ISO string without offset | '2026-12-08T13:00' |
A wall-clock time in the event's timeZone, or in the display zone when the event has none. |
ISO string with Z or offset |
'2026-12-08T19:00:00Z' |
That exact instant. |
Date or number |
new Date(…), 1796756400000 |
That exact instant (numbers are epoch milliseconds). |
A time without an offset and without an event zone is floating: it means "13:00 wherever the calendar is displayed". If you switch the display zone, floating events keep their wall-clock time, while instants stay at the same moment and move on the grid. Pick the form that matches your data:
- Floating times for things defined on the local clock of whoever looks at them, such as a personal reminder or a single-site business where every viewer is in the same zone.
- Instants for anything your server stores in UTC, such as appointments booked through an API.
- Zoned wall-clock times (
timeZoneon the event) for things that happen at a local time somewhere specific: a meeting in the Berlin office, a class at a gym in Austin.
All-day events are dates, not instants. December 25 is December 25 in every display zone.
Events with their own zone#
Give an event a timeZone and its wall-clock strings are read in that zone, then converted to the display zone:
createCalendar(container, {
view: 'week',
date: '2026-12-07',
timeZone: 'America/Chicago',
events: [
{
id: 'berlin-review',
title: 'Quarterly review with the Berlin office',
start: '2026-12-09T16:00',
end: '2026-12-09T17:30',
timeZone: 'Europe/Berlin',
},
{
id: 'austin-install',
title: 'Kiosk installation, Austin store',
start: '2026-12-10T08:00',
end: '2026-12-10T12:00',
timeZone: 'America/Chicago',
},
],
});The Berlin review appears at 09:00 to 10:30 for this Chicago viewer. An event with an unknown timeZone logs a warning and is treated as floating.
Recurring events across zones#
A recurring event is expanded in its own zone, so each occurrence keeps its local time across daylight saving changes:
createCalendar(container, {
view: 'week',
timeZone: 'Europe/London',
events: [
{
id: 'ny-standup',
title: 'New York team stand-up',
start: '2027-03-08T09:00',
end: '2027-03-08T09:15',
timeZone: 'America/New_York',
rrule: 'FREQ=WEEKLY;BYDAY=MO',
},
],
});In London this stand-up shows at 14:00 on 8 March, 13:00 on 15 and 22 March (the United States has moved its clocks forward, the United Kingdom has not yet), and 14:00 again from 29 March. In New York it is always 09:00.
A recurring event without its own zone repeats in the display zone. UNTIL values without Z are read in the event's zone; toICS converts them to UTC on export, as RFC 5545 requires for zoned series.
Daylight saving edge cases#
- Times that do not exist, such as 02:30 on the night clocks spring forward, move forward by the gap:
'2027-03-28T02:30'in Berlin becomes 03:30. - Times that happen twice, on the night clocks fall back, resolve to the first occurrence. Pass an instant with an explicit offset when you mean the second one.
- The time grid places events by wall-clock time. An overnight event that crosses a clock change is drawn one hour longer or shorter than it actually lasts. The event's
startandendare still exact.
How times are written back#
After a drag, resize or updateOccurrence, the calendar writes the new times into the event in the same style you used:
| You passed | You get back |
|---|---|
A floating string, '2026-12-08T13:00' |
A floating string, '2026-12-08T14:30' |
A zoned string (event has timeZone) |
A string in the event's zone |
A string with an offset or Z |
A UTC string, '2026-12-08T20:30:00Z' |
A Date |
A Date |
| A number | A number |
| A date-only string (all-day) | A date-only string |
So data you store keeps its format, and you never have to guess whether a value is local or UTC. Payload fields such as start and end in eventDrop are always Date objects, which are instants; format them with the zone you mean:
const timeFormat = new Intl.DateTimeFormat('en-US', {
timeZone: 'America/Chicago',
dateStyle: 'medium',
timeStyle: 'short',
});
calendar.on('eventDrop', ({ event, start }) => {
toast.show(`${event.title} moved to ${timeFormat.format(start)}`);
});Event sources and time zones#
An event source receives the display zone as timeZone in its request, always as a concrete IANA name (the browser's zone is resolved for you), so your server can query by local day boundaries:
createCalendar(container, {
timeZone: 'Europe/London',
eventSource: async ({ start, end, timeZone, signal }) => {
const query = new URLSearchParams({ from: start.toISOString(), to: end.toISOString(), tz: timeZone });
const response = await fetch(`/api/bookings?${query}`, { signal });
return response.json();
},
});Testing with a fixed clock#
now is a function that returns the current time, which makes "today", the now indicator and screenshots deterministic:
createCalendar(container, {
view: 'week',
timeZone: 'America/Chicago',
now: () => new Date('2026-12-09T16:15:00Z'),
events,
});Return an instant: a Date, a number or a string with an offset. A floating string such as '2026-12-09T10:15' is not accepted here and the real clock is used instead.
Next steps#
- Recurrence for rules and exceptions.
- iCalendar for
TZIDhandling on import and export.