Skip to content

Support "every N days/weeks/months/years" recurrence - #12

Merged
codeling merged 1 commit into
mainfrom
recurrence-interval-and-unit
Oct 3, 2026
Merged

codeling merged 1 commit into
mainfrom
recurrence-interval-and-unit

Conversation

@codeling

@codeling codeling commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Recurrence used to be one column holding a number of days, which can't express "every 3 weeks" or "every 10 years" (30 days is not a month, 365 days is not a year).
  • todo.recurrenceMode is now the unit (0 none, 1 day, 2 week, 3 month, 4 year) and the new todo.recurrenceInterval holds N (1–999).
  • Both columns stay on the todo table. Recurrence is 1:1 with a todo and read on every list query, so a separate table would only add a join.
  • The edit dialog has a number field next to a unit select, in English and German.
  • The next due date is computed in SQL with DATE_ADD(..., INTERVAL n UNIT). The helper recurrenceNextSql() is in the new queries/recurrence.php.
  • update.php validates the unit and the interval.

Migration

sql/update-012.sql adds the column and converts the old day values. For example 7 becomes 1 week, 14 becomes 2 weeks, 30 becomes 1 month, 91 becomes 3 months and 365 becomes 1 year. Values that match nothing stay as days. sql/install.sql has the new schema and db.version is now 12.

Testing

  • Updated the existing API tests to the new fields.
  • Added a test covering each unit and the validation errors.
  • PHP lint and node --check pass.
  • Not run: the DB-backed tests and the migration, because there was no MySQL in my environment. Please run npm test and try update-012.sql on an old-schema copy.

🤖 Generated with Claude Code

https://claude.ai/code/session_01V7dZbS92Qut5kn2ftoFq72


Generated by Claude Code

…ars)

recurrenceMode is now the unit (none/days/weeks/months/years) and the new
recurrenceInterval column the count. update-012.sql migrates existing
day-based values.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V7dZbS92Qut5kn2ftoFq72
@codeling
codeling merged commit 53f69b3 into main Oct 3, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants