Skip to content

Keep monthly recurrence on its original day of month - #676

Merged
quintushr merged 5 commits into
spliit-app:mainfrom
t0ma5:fix/monthly-recurrence-anchor
Oct 13, 2026
Merged

quintushr merged 5 commits into
spliit-app:mainfrom
t0ma5:fix/monthly-recurrence-anchor

Conversation

@t0ma5

@t0ma5 t0ma5 commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • A monthly expense created on the 31st was clamped to 28 February, and every later month stayed on the 28th. The next date was computed from the previous occurrence, so the original day was lost.
  • Store anchorDay on RecurringExpenseLink. February still clamps to the 28th, and March returns to the 31st.
  • Editing the expense date on an open series now moves the next occurrence. A series that has already drifted cannot recover its original day.

Test plan

  • npm test -- src/lib/recurrence.test.ts
  • Apply the Prisma migration 20261012000000_add_recurring_anchor_day
  • Create a monthly expense on 31 January and confirm the generated dates are 28 February, then 31 March
  • Change that expense date before the next copy is created and confirm the next date follows the new day

t0ma5 added 2 commits October 12, 2026 00:43
A series created on the 31st was clamped to 28 February and then stayed on the 28th. Store the anchor day on the recurring link and clamp only months that are too short.
@quintushr
quintushr self-requested a review October 13, 2026 17:05
@quintushr quintushr self-assigned this Oct 13, 2026
@quintushr

Copy link
Copy Markdown
Collaborator

Thanks @t0ma5 for the PR!

I added some tests and added a guard against an infinite loop when the recurrence rule is NONE.

@quintushr
quintushr merged commit c8bfa76 into spliit-app:main Oct 13, 2026
3 checks passed
@quintushr quintushr mentioned this pull request Oct 14, 2026
6 tasks
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