Skip to content

Consistent renewal date format + always show the live next renewal#10

Merged
saikumarbt merged 1 commit into
mainfrom
renewal-date-display
Jul 14, 2026
Merged

Consistent renewal date format + always show the live next renewal#10
saikumarbt merged 1 commit into
mainfrom
renewal-date-display

Conversation

@saikumarbt

Copy link
Copy Markdown
Owner
  • formatSubscriptionDateTime now renders "MMM D, YYYY" (e.g. "Jun 8, 2026"), matching the "Started on" field and removing MM/DD ambiguity.
  • Subscription detail computes the next renewal live via getNextRenewal (rolling a passed date forward) instead of showing the raw stored value, so the displayed date and the countdown always agree and never show a stale/past date.
  • Add exhaustive next-renewal tests for every billing cycle (weekly → annual + custom), plus started-today and future-start cases.

Note: for a sub started 2026-06-08 (monthly) viewed on 2026-07-13, the next renewal is correctly 2026-08-08 — the 07-08 charge has already passed.

- formatSubscriptionDateTime now renders "MMM D, YYYY" (e.g. "Jun 8, 2026"),
  matching the "Started on" field and removing MM/DD ambiguity.
- Subscription detail computes the next renewal live via getNextRenewal
  (rolling a passed date forward) instead of showing the raw stored value,
  so the displayed date and the countdown always agree and never show a
  stale/past date.
- Add exhaustive next-renewal tests for every billing cycle (weekly →
  annual + custom), plus started-today and future-start cases.

Note: for a sub started 2026-06-08 (monthly) viewed on 2026-07-13, the
next renewal is correctly 2026-08-08 — the 07-08 charge has already passed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a05b7019-1eea-45ce-adfe-7c04a58a5472

📥 Commits

Reviewing files that changed from the base of the PR and between 22de40e and dc9328c.

📒 Files selected for processing (4)
  • __tests__/billing.test.ts
  • __tests__/utils.test.ts
  • app/subscriptions/[id].tsx
  • lib/utils.ts

Summary by CodeRabbit

  • New Features

    • Subscription details now show the next renewal date and countdown based on the current billing cycle.
  • Bug Fixes

    • Renewal dates now roll forward correctly when a subscription’s original date has passed.
    • Renewal date and countdown displays now stay synchronized.
  • Style

    • Dates now use a clearer month-name format, such as “Mar 20, 2026.”

Walkthrough

The subscription detail screen now computes next renewal dates and countdowns from live subscription data. Date formatting uses month names, and tests cover renewal roll-forward behavior across billing cycles and updated display formatting.

Changes

Renewal display flow

Layer / File(s) Summary
Live renewal calculation and display
app/subscriptions/[id].tsx, __tests__/billing.test.ts
The screen calculates and displays the computed next renewal and countdown, while tests cover past, current, and future subscription starts across billing cycles.
Subscription date formatting
lib/utils.ts, __tests__/utils.test.ts
Valid dates now use MMM D, YYYY formatting, with the updated output covered by tests.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SubscriptionScreen
  participant getNextRenewal
  participant dayjs
  SubscriptionScreen->>getNextRenewal: subscription renewal/start/billing-cycle inputs
  getNextRenewal-->>SubscriptionScreen: nextRenewal
  SubscriptionScreen->>dayjs: compare renewal startOf("day") with today
  dayjs-->>SubscriptionScreen: daysLeft
  SubscriptionScreen-->>SubscriptionScreen: render next renewal and countdown
Loading

Poem

A rabbit hops through dates anew,
Rolling renewals into view.
“Mar 20” shines where numbers lay,
Cycles march from day to day.
The countdown thumps—hip hop, hooray!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the two main changes: renewal date formatting and live next-renewal display.
Description check ✅ Passed The description accurately matches the changeset and explains the formatting, live renewal logic, and added tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch renewal-date-display

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@saikumarbt
saikumarbt merged commit 9b19a4c into main Jul 14, 2026
1 check passed
This was referenced Jul 16, 2026
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.

1 participant