Recurrence module #29
Parent#
https://github.com/TanStack/time/issues/25
What to build#
Extract recurrence expansion and editing into a proper module that plugs into the kernel's read and write pipelines. When registered, the module expands Master Events into ephemeral Occurrences within the current viewport and handles all recurrence-specific writes (edit-this, edit-this-and-following, delete-this, delete-all).
Also extend the `RecurrenceRule` model to cover the full UI-builder subset: add `byMonthDay` (supports negative values, e.g. `-1` = last day of month) and ordinal weekdays (e.g. `{ weekday: 2, nth: 2 }` = 2nd Tuesday, `{ weekday: 5, nth: -1 }` = last Friday).
Occurrences are ephemeral — derived in the projection, never stored. The Master Event carries the rule; Overrides and Exceptions live on the master's rule.
Acceptance criteria#
- `RecurrenceModule` plugs into the kernel via the module API (#28) and is listed as a registered module in the Calendar product factory
- A Master Event with a `RecurrenceRule` produces the correct Occurrences for the current viewport
- Editing a single Occurrence creates an Override keyed by original start (RECURRENCE-ID); other occurrences are unaffected
- Editing "this and following" splits the master at the occurrence boundary, producing a new master for the remainder
- Deleting a single Occurrence adds it to `exDates` (Exception); the series continues
- `byMonthDay` (including negative values) generates the correct occurrences for monthly/yearly rules
- Ordinal weekday (`{ weekday, nth }`) generates the correct occurrences (e.g. 2nd Tuesday, last Friday)
- `goToNextOccurrence` / `goToPreviousOccurrence` navigate correctly across the series
- Removing the `RecurrenceModule` from the module list causes recurrence-related code to tree-shake out of the bundle
Blocked by#
bart-krakowski(GitHub profile, opens in a new tab) added labelsenhancement
Sign in to join this conversation.