Birch UI v0.1
Pricing

Recurring eventsScheduler

Repeat events with RFC 5545 rules, skip dates with exdates, and decide whether a drag, resize or delete changes one occurrence or the whole series.

Open .md

Give an event an RFC 5545 rule in rrule and it repeats on the timeline: a daily vehicle check, weekly planned maintenance, a monthly inspection. The rules are read by the same engine as the Event Calendar, so a series means the same thing in both products.

A recurring event#

maintenance.ts
scheduler.addEvent({
  id: 'ppm-hillside',
  resourceId: 'maya',
  title: 'Planned maintenance: Hillside Care Home boilers',
  start: '2026-11-02T08:00',
  end: '2026-11-02T10:00',
  rrule: 'FREQ=WEEKLY;BYDAY=MO',
  exdates: ['2026-12-28T08:00'],
});
  • start and end are the first occurrence; every occurrence has the same duration.
  • rrule is written with or without the RRULE: prefix. FREQ=DAILY|WEEKLY|MONTHLY|YEARLY, INTERVAL, COUNT, UNTIL, BYDAY (including 1MO and -1FR), BYMONTHDAY, BYMONTH, BYSETPOS and WKST are supported. Unsupported parts are ignored with one console warning; an invalid rule shows the event once, also with a warning.
  • exdates skips occurrences. A date-time skips the occurrence that starts then; a plain date ('2026-12-28') skips every occurrence on that day.
  • Occurrences keep their wall-clock time in the scheduler's timeZone across daylight-saving changes.
  • Occurrences are generated only for the visible range, up to 5,000 per series, so a rule without an end costs nothing outside the view.
SchedulerEventinterface@birchui/schedulerFull reference
PropertyTypeDescription
rruleoptionalstring—
exdatesoptionalDateInput[]—
recurringEventIdoptionalstring—
recurrenceIdoptionalstring—

Occurrence ids#

Each occurrence is rendered as an event whose id is the series id, @, and the occurrence's local start: 'ppm-hillside@2026-11-23T08:00:00'. It carries recurringEventId (the series id) and recurrenceId ('2026-11-23T08:00:00').

  • getEvents() returns the series once, as you stored it.
  • getEventById(occurrenceId) and getEventsInRange() also return occurrences.
  • updateEvent(occurrenceId, patch) and removeEvent(occurrenceId) change a single occurrence, the same way a drag or delete does.

This occurrence or the whole series#

When a user drags, resizes or deletes an occurrence, eventDrop, eventResize and eventRemove fire before the change is applied, with occurrence and a mutable scope that starts as 'this':

SchedulerOccurrenceinterface@birchui/schedulerFull reference
PropertyTypeDescription
idstring—
occurrenceIdstring—
recurrenceIdstring—
startDate—
endDate—
eventTEvent—
scope Drag or resize Delete
'this' Adds the occurrence to the series' exdates and adds a single event with the occurrence id, recurringEventId and recurrenceId at the new time Adds the occurrence to exdates
'all' Moves or resizes the whole series by the same amount; weekday rules (BYDAY) shift with it Removes the series

Set scope synchronously inside the listener:

TypeScript
const wholeSeries = document.querySelector<HTMLInputElement>('#whole-series')!;

scheduler.on('eventDrop', (change) => {
  if (change.occurrence) change.scope = wholeSeries.checked ? 'all' : 'this';
});

scheduler.on('eventRemove', (change) => {
  if (change.occurrence) change.scope = confirm('Delete every visit in this series?') ? 'all' : 'this';
});

Saving recurring changes#

A change to one occurrence touches two records: the series (a new exdates entry) and the detached single event. Persist both. The historyChange event lists every record a user action changed, with before and after, which makes it the simplest place to save:

TypeScript
scheduler.on('historyChange', ({ action, changes }) => {
  if (action === 'clear') return;
  for (const { id, before, after } of changes) {
    if (after === null) void jobs.remove(id);
    else if (before === null) void jobs.create(after);
    else void jobs.update(id, after);
  }
});

historyChange fires unless history is turned off with undoRedo: false; see Undo and redo.

↑ ↓ to move, Enter to open, Esc to close