Skip to content

Calendar: a Repeat field instead of recurrence JSON (#1801) - #1896

Closed
michielbdejong wants to merge 4 commits into
developfrom
claude/calendar-repeat
Closed

michielbdejong wants to merge 4 commits into
developfrom
claude/calendar-repeat

Conversation

@michielbdejong

@michielbdejong michielbdejong commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1801

Decision (Michiel, 25 Sep): Atomic's own calendar gets a native "repeat" setting.

What changes

The row dialog opened from a calendar view has a Repeat section above the other fields, in place of the raw Recurrence JSON:

  • Repeat: does not repeat, daily, weekly (weekday toggles), monthly (on day N, or on the nth / last weekday), yearly; "Every N days/weeks/months/years".
  • Ends: never, on a date, or after N times.
  • A summary in words: "Every Thursday until 31 Dec", "Monthly on the second Thursday", "Every day, 10 times".
  • A payload the control can't represent (exception dates, several rules, BYSETPOS, a month day that isn't the start's…) shows as Custom, is never rewritten by the control, and "Show JSON" opens the existing JSON editor for it. Picking a repeat replaces it.

Table view (decided by Michiel)

The table view's row dialog shows the same Repeat field (summary, options, Custom with Show JSON) in place of the Recurrence JSON, and the Recurrence cell shows the summary ("Every Tuesday, 10 times"), read-only; editing the cell still opens the JSON editor. Same detection as the calendar (useCalendarRecurrenceProp); the series repeats from the calendar's Day column, else the class's first date column. Unlike the calendar, the table creates no property: a class without a recurrence or date column, or a row without a day, keeps the JSON editor. New: Calendar/useTableCalendarRow.ts, Calendar/RepeatSummaryCell.tsx.

Where it is stored

  • The payload the view already expands (@tomic/lib calendar-recurrence.ts), in the property with shortname atomic-calendar-recurrence (the same one the atomic-plugins Event ontology defines; imported lt-google-calendar-property- ones still match).
  • How the property is found: the same way the calendar picks its date column: an existing property on the class is adopted. If the class has none (every native table today), nothing is created by opening the view; the first time a row is set to repeat, a "Recurrence" JSON property with that shortname is added to the class (createPropertyOnClass, now with an optional shortname).
  • A row's own series is written as { calendarId: "atomic", event: { id, start, end, recurrence: ["RRULE:…"] } }. The view fills id/start/end from the row's current columns and re-anchors the rule, so moving the row moves the series (a weekly series on its start's weekday follows it to the new weekday). Imported payloads (any other calendarId) stay the provider's, as before, and still only apply where the view is placed by atomic-calendar-day; native series work on any date column (e.g. an Issue Tracker's auto-created "Date").
  • All-day end stays exclusive; nothing existing is reinterpreted.
  • Also reads a payload that was saved as a JSON-encoded string (finding 4 of the session).

New: browser/lib/src/calendar-repeat.ts (model ⇄ RRULE), Calendar/RepeatField.tsx, CalendarRowFields.tsx, calendarRows.ts, repeatSummary.ts, useCalendarRecurrenceProp.ts.

Tests

  • lib/src/calendar-repeat.test.ts: build → parse round trips for every option (all-day and timed), timed UNTIL at end of day in the event's zone, "last" weekday, other calendars' spellings, 16 Custom fallbacks, and that a native payload expands on the following weeks.
  • Calendar/repeatSummary.test.ts: the summary text for every option, "Does not repeat" and "Custom".
  • Calendar/calendarRows.test.ts: a moved row takes its series along; imported payloads untouched; custom kept.
  • Calendar/RepeatField.test.tsx (component): choosing Weekly; Custom with Show JSON.
  • TablePage/ExpandedRowDialog.test.tsx (component): the table row dialog shows the Repeat field for a recurrence property and hides its JSON; choosing Weekly writes the same nativeCalendarPayload the calendar writes; a row without a day and a class without a recurrence property keep the JSON; the cell shows the summary.
  • e2e/tests/calendar.spec.ts › calendar repeat: sets Repeat to Weekly in the dialog and checks the event on the next three weeks and not the day after, then sets "Does not repeat" and checks the series is gone.

Screenshots

Before / after, desktop and 375 px (Europe/Amsterdam, en-GB), shared with the developer in chat:
1801-before-dialog-{desktop,375}.png, 1801-before-calendar-{desktop,375}.png, 1801-after-1801-dialog-{desktop,375}.png, 1801-after-1801-calendar-{desktop,375}.png. Table view: 1801-table-dialog-{desktop,375}.png, 1801-table-dialog-375-json.png, 1801-table-grid.png.

Questions for Michiel

  1. What "Custom" means to users. Conservative default: the label "Custom", the rule is left untouched, and a hint says the Repeat field can't show all its options, with Show JSON. Should Custom instead be hidden behind an "Advanced" section, or should we try to describe more rules?
  2. The table view's row dialog: decided, it gets the same Repeat field (see above).
  3. Moving an event's Day moves the series (and "every Thursday" becomes "every Friday" when the start moves to a Friday). Google asks "this event / all events" here; we silently move all. OK?

🤖 Generated with Claude Code

Michiel de Jong and others added 2 commits September 29, 2026 15:05
The row dialog opened from a calendar view shows a Repeat field instead
of the raw recurrence JSON: none, daily, weekly on chosen days, monthly
by date or nth weekday, or yearly, ending never, on a date or after N
times, with a summary in words. It writes the payload the view already
expands; a payload it cannot show reads as Custom, kept as is, with its
JSON one click away.

A table without a recurrence property gets one (shortname
atomic-calendar-recurrence, as in the Event ontology) when a row first
repeats. A row's own series (calendarId "atomic") follows the row's
date columns, so moving the row moves the series; imported payloads
stay the provider's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Playwright test makes an event repeat weekly from the row dialog and
checks it appears on the following weeks. The Custom hint moves into
its own component: inside its guard the extractor dropped it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Setting undefined through Resource.set failed validation, so turning a
repeat off raised an error. Remove the value instead. The e2e test now
turns the repeat off again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michielbdejong

Copy link
Copy Markdown
Contributor Author

Michiel's decisions:

  1. Moving a repeating event's day moves all occurrences, for now. The "this event or all events" question is filed separately.
  2. The table view's row dialog reuses this Repeat field instead of the raw JSON. It's being added to this PR.

The table view's row dialog now shows the calendar's Repeat field for the
recurrence property instead of its raw JSON, with the JSON behind Show JSON.
It uses the calendar's detection (`atomic-calendar-recurrence` or the
imported `lt-google-calendar-property-` one) and repeats from the calendar's
Day, else the class's first date column. A table creates no property: a
class without a recurrence or date column, or a row without a day, keeps the
JSON editor. The recurrence cell shows the Repeat summary, read-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joepio

joepio commented Sep 30, 2026

Copy link
Copy Markdown
Member

Trekmeester review (not batched tonight; this needs maintainer sign-off): it introduces a stored native recurrence payload ({calendarId: "atomic", event: {…, recurrence:[RRULE]}}) and adds a Recurrence property to the user's class on first use. Moving a row's Day re-anchors the whole series without asking ("every Thursday" becomes "every Friday"). Tests look good. The format, the schema mutation and the re-anchor behaviour need a decision from Joep/Polle/Michiel. It also conflicts only in the four .po files.

joepio commented Oct 5, 2026

Copy link
Copy Markdown
Member

Landed on develop in the combined batch #2060 (95707c0), tested together in one full run. Closing as included.


Generated by Claude Code

@joepio joepio closed this Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

browser enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calendar: let users make an event repeat without editing JSON

2 participants