Functional Weave
Code in Rust

todo.reschedule-recurrence@1.0.0

README.md

1,367 bytes · view raw

# todo.reschedule-recurrence

When someone edits a repeating todo and changes its due date, the series
moves with it: the new date becomes the recurrence's anchor.

todo.item's `Recurrence` counts every occurrence from its `anchor`, the
series' first date, and `validateDraft` refuses a due date before the
anchor. So an edit form that simply stored the new date would either be
refused (moved earlier) or keep repeating on the old rhythm (moved later).
Moving the anchor is what a person means by "move this to Friday".

| recurrence | fromDue → toDue | result |
| --- | --- | --- |
| null | anything | null |
| any | toDue null | unchanged (validateDraft then says a repeating todo needs a due date) |
| any | toDue = fromDue | unchanged |
| any | toDue ≠ fromDue | the same frequency and interval, anchored on toDue |

- **An unchanged date keeps the anchor.** A monthly series from 31 January is
  due 28 February after one roll forward; saving an edit to its title must
  not re-anchor it on the 28th, or it would lose the month end.
- A new date is taken as given, even a Saturday for a weekday series:
  todo.next-occurrence decides the following dates from there.
- Every date given (`fromDue`, `toDue`, the anchor) must be a real ISO date,
  with or without a recurrence; the messages are dates.add-days's
  (`"2026-02-30" is not a real calendar date`).