Skip to content

fix(#1036): eliminate billing-cycle date drift with date-fns - #1111

Merged
Calebux merged 1 commit into
Calebux:mainfrom
alexatsejames-alt:fix/1036-billing-cycle-date-drift
Jul 26, 2026
Merged

fix(#1036): eliminate billing-cycle date drift with date-fns#1111
Calebux merged 1 commit into
Calebux:mainfrom
alexatsejames-alt:fix/1036-billing-cycle-date-drift

Conversation

@alexatsejames-alt

Copy link
Copy Markdown
Contributor
  • Add weekly and annual cases to calculateNextRenewal using addWeeks/addYears
  • Extend billing_cycle union type to include 'weekly' | 'annual' (was silently falling through to default, returning unchanged date on every renewal)
  • Add property-style tests covering month-end clamping (Jan 31 -> Feb 28/29), quarterly end clamping (Mar 31 -> Jun 30), and no-drift assertions over 12 monthly and 52 weekly iterations
  • Fix misleading test description 'add 365 days' -> calendar-aware addYears

Description

Briefly describe what this PR does.


Related Issue

Closes #


Test Plan

  • Tested locally
  • Verified expected behavior
  • No regressions introduced

Screenshots (if applicable)


Checklist

- Add weekly and annual cases to calculateNextRenewal using addWeeks/addYears
- Extend billing_cycle union type to include 'weekly' | 'annual' (was silently
  falling through to default, returning unchanged date on every renewal)
- Add property-style tests covering month-end clamping (Jan 31 -> Feb 28/29),
  quarterly end clamping (Mar 31 -> Jun 30), and no-drift assertions over
  12 monthly and 52 weekly iterations
- Fix misleading test description 'add 365 days' -> calendar-aware addYears
@drips-wave

drips-wave Bot commented Jul 24, 2026

Copy link
Copy Markdown

Hey @alexatsejames-alt! 👋 It looks like this PR isn't linked to any issue.

If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g., Closes #123), or by clicking a button below:

Issue Title
#1036 Reminder billing-cycle date drift across intervals Link to this issue

ℹ️ Learn more about linking PRs to issues

@Calebux
Calebux merged commit 4a8018b into Calebux:main Jul 26, 2026
23 of 32 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