Cotton code
73 lines · 6.1 KB · JSONRaw
{  "about": "What a repeating todo's series is owed at `now`. `latest` is its latest occurrence not in the bin ({at, finished}: finished is done, dropped or missed), `mark` the newest occurrence it ever made. An open latest is the series' one live copy and is owed nothing, past or ahead (Days, 20 Nov 2026). `want` the occurrences to make, ascending; the mark advances to the last of them. `refused` means the plan is refused. Read by cotton-core's todo_recurrence tests and the Worker's recurrence.test.ts.",  "cases": [    { "name": "a new series anchored in the past: its first only, which is its one live copy until it is done or skipped",      "rrule": "FREQ=MONTHLY", "dtstart": "2026-06-02T09:00:00.000Z", "zone": "UTC", "now": "2026-08-16T12:00:00.000Z",      "latest": null, "mark": null, "paused": false,      "want": ["2026-06-02T09:00:00.000Z"] },    { "name": "a new series anchored ahead: its first only",      "rrule": "FREQ=MONTHLY", "dtstart": "2026-09-02T09:00:00.000Z", "zone": "UTC", "now": "2026-08-16T12:00:00.000Z",      "latest": null, "mark": null, "paused": false,      "want": ["2026-09-02T09:00:00.000Z"] },    { "name": "the current occurrence is open and ahead: nothing owed",      "rrule": "FREQ=MONTHLY", "dtstart": "2026-06-02T09:00:00.000Z", "zone": "UTC", "now": "2026-08-16T12:00:00.000Z",      "latest": { "at": "2026-09-02T09:00:00.000Z", "finished": false }, "mark": "2026-09-02T09:00:00.000Z", "paused": false,      "want": [] },    { "name": "the current occurrence passed open: it stays the one live copy and nothing is made beside it (Days, 20 Nov 2026: a repeat never stacks)",      "rrule": "FREQ=MONTHLY", "dtstart": "2026-06-02T09:00:00.000Z", "zone": "UTC", "now": "2026-08-16T12:00:00.000Z",      "latest": { "at": "2026-08-02T09:00:00.000Z", "finished": false }, "mark": "2026-08-02T09:00:00.000Z", "paused": false,      "want": [] },    { "name": "the live copy done late: the next after now, never one already past",      "rrule": "FREQ=DAILY", "dtstart": "2026-08-10T09:00:00.000Z", "zone": "UTC", "now": "2026-08-16T12:00:00.000Z",      "latest": { "at": "2026-08-12T09:00:00.000Z", "finished": true }, "mark": "2026-08-12T09:00:00.000Z", "paused": false,      "want": ["2026-08-17T09:00:00.000Z"] },    { "name": "the current occurrence was done ahead of its moment: the next after it",      "rrule": "FREQ=MONTHLY", "dtstart": "2026-06-02T09:00:00.000Z", "zone": "UTC", "now": "2026-08-16T12:00:00.000Z",      "latest": { "at": "2026-09-02T09:00:00.000Z", "finished": true }, "mark": "2026-09-02T09:00:00.000Z", "paused": false,      "want": ["2026-10-02T09:00:00.000Z"] },    { "name": "months passed since the last one: the next only, the missed moments are never made",      "rrule": "FREQ=MONTHLY", "dtstart": "2026-06-02T09:00:00.000Z", "zone": "UTC", "now": "2026-08-16T12:00:00.000Z",      "latest": { "at": "2026-06-02T09:00:00.000Z", "finished": true }, "mark": "2026-06-02T09:00:00.000Z", "paused": false,      "want": ["2026-09-02T09:00:00.000Z"] },    { "name": "the only occurrence ahead was binned (skip next): the one after the mark",      "rrule": "FREQ=MONTHLY", "dtstart": "2026-06-02T09:00:00.000Z", "zone": "UTC", "now": "2026-08-16T12:00:00.000Z",      "latest": null, "mark": "2026-09-02T09:00:00.000Z", "paused": false,      "want": ["2026-10-02T09:00:00.000Z"] },    { "name": "a mark later than the latest (an imported series): never behind the mark",      "rrule": "FREQ=MONTHLY", "dtstart": "2026-06-02T09:00:00.000Z", "zone": "UTC", "now": "2026-08-01T12:00:00.000Z",      "latest": { "at": "2026-07-02T09:00:00.000Z", "finished": true }, "mark": "2026-08-02T09:00:00.000Z", "paused": false,      "want": ["2026-09-02T09:00:00.000Z"] },    { "name": "paused: nothing owed",      "rrule": "FREQ=MONTHLY", "dtstart": "2026-06-02T09:00:00.000Z", "zone": "UTC", "now": "2026-08-16T12:00:00.000Z",      "latest": { "at": "2026-08-02T09:00:00.000Z", "finished": true }, "mark": "2026-08-02T09:00:00.000Z", "paused": true,      "want": [] },    { "name": "a spent COUNT: nothing more",      "rrule": "FREQ=MONTHLY;COUNT=2", "dtstart": "2026-06-02T09:00:00.000Z", "zone": "UTC", "now": "2026-08-16T12:00:00.000Z",      "latest": { "at": "2026-07-02T09:00:00.000Z", "finished": false }, "mark": "2026-07-02T09:00:00.000Z", "paused": false,      "want": [] },    { "name": "an occurrence done exactly at its moment: the next after it",      "rrule": "FREQ=DAILY", "dtstart": "2026-08-15T09:00:00.000Z", "zone": "UTC", "now": "2026-08-16T09:00:00.000Z",      "latest": { "at": "2026-08-16T09:00:00.000Z", "finished": true }, "mark": "2026-08-16T09:00:00.000Z", "paused": false,      "want": ["2026-08-17T09:00:00.000Z"] },    { "name": "London across spring-forward keeps nine o'clock on the wall",      "rrule": "FREQ=DAILY", "dtstart": "2026-03-28T09:00:00.000Z", "zone": "Europe/London", "now": "2026-03-28T12:00:00.000Z",      "latest": { "at": "2026-03-28T09:00:00.000Z", "finished": true }, "mark": "2026-03-28T09:00:00.000Z", "paused": false,      "want": ["2026-03-29T08:00:00.000Z"] },    { "name": "the same rule in Kolkata has no shift",      "rrule": "FREQ=DAILY", "dtstart": "2026-03-28T09:00:00.000Z", "zone": "Asia/Kolkata", "now": "2026-03-28T12:00:00.000Z",      "latest": { "at": "2026-03-28T09:00:00.000Z", "finished": true }, "mark": "2026-03-28T09:00:00.000Z", "paused": false,      "want": ["2026-03-29T09:00:00.000Z"] },    { "name": "no zone is refused, never read as UTC",      "rrule": "FREQ=MONTHLY", "dtstart": "2026-06-02T09:00:00.000Z", "zone": "", "now": "2026-08-16T12:00:00.000Z",      "latest": null, "mark": null, "paused": false,      "refused": true },    { "name": "a rule nothing expands is refused",      "rrule": "FREQ=HOURLY", "dtstart": "2026-09-02T09:00:00.000Z", "zone": "UTC", "now": "2026-08-16T12:00:00.000Z",      "latest": null, "mark": null, "paused": false,      "refused": true },    { "name": "paused answers nothing before any refusal",      "rrule": "FREQ=HOURLY", "dtstart": "2026-06-02T09:00:00.000Z", "zone": "", "now": "2026-08-16T12:00:00.000Z",      "latest": null, "mark": null, "paused": true,      "want": [] }  ]}