fix(deploy-web): show billing charge dates in UTC#3258
Conversation
The billing history table rendered the Stripe charge date with toLocaleDateString(), which uses the viewer's local timezone. Stripe receipts use the charge's UTC date, so the two could differ by a day for users far from UTC. Render the date with timeZone "UTC" and label the column "Date (UTC)" so it matches the Stripe receipt regardless of the viewer's location. The created value is a Stripe Unix timestamp, so UTC is its canonical basis. Updated the BillingView spec to match. Closes akash-network#2010 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe billing view component and its test are updated to display charge creation dates in UTC timezone instead of the user's local browser timezone. The column header is relabeled to indicate "(UTC)" and date formatting now explicitly specifies ChangesBilling date timezone alignment
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Assessment against linked issues
Out-of-scope changesNo out-of-scope changes detected. All modifications directly address the timezone misalignment between the UI and Stripe receipts. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
baktun14
left a comment
There was a problem hiding this comment.
Thanks for the PR and the clear write-up! The change is clean and mechanically correct — created is a UTC epoch, and the * 1000 / timeZone: "UTC" handling is right. Also, don't worry about the npm ci failure you hit: that's a local Node 24 / npm 11 version mismatch, not lockfile drift. CI and the spec pass fine.
One thing I want to confirm before merging, because it decides whether this actually closes #2010:
Does the receipt show UTC, or the account timezone? The API created value is always UTC, but the displayed date on customer-facing receipts resolves as: customer timezone (if set) → account timezone → UTC fallback (customer emails, time zone customization). So this matches the receipt only if our Stripe account timezone is set to UTC. That's something I need to check on our side (you wouldn't have access) — I'll confirm our account setting and report back. If it's not UTC, the right fix is to render in the account timezone rather than UTC.
Second — consistency with the CSV export. That path already formats dates in the viewer's local timezone:
BillingContainersendsIntl.DateTimeFormat().resolvedOptions().timeZoneto the API- the API formats each row with
toLocaleString("en-CA", { timeZone })intransformTransactionForCsv
So with this change the on-screen table shows UTC while the CSV of the same rows shows local time — they can disagree across a midnight-UTC boundary. Whatever timezone we settle on, it should apply to both surfaces so they always agree.
Suggested sequencing: let me confirm our account timezone first (that decides UTC vs account-TZ), then we align the table and the CSV export on that one timezone. I'll follow up here once I've checked. Thanks again for digging into this!
|
Hi, thanks for the careful review and for digging into the receipt resolution order, that's a good catch. You're right that
I'm happy to extend this PR to cover both surfaces once you've confirmed the account timezone, just let me know UTC vs account-TZ and I'll align the table and the export on the one source. Thanks again. Rene |
Hi, and thanks for the work on Console.
Fixes #2010. The billing history table rendered the Stripe charge date with
toLocaleDateString(), which formats in the viewer's local timezone. Stripe receipts use the charge's UTC date, so for users far from UTC the Console could show a day that differs from the receipt.This renders the date with
{ timeZone: "UTC" }and labels the columnDate (UTC)so it is unambiguous and matches the receipt regardless of where the viewer is. Thecreatedvalue is a Stripe Unix timestamp, so UTC is its canonical basis.Changed
BillingView.tsx(thecreatedcolumn) and updated its spec to match.Note on local testing
The repo targets Node 24 / npm 11, and the committed lockfile is currently out of sync (
npm cifails on missing esbuild entries unrelated to this change), so I could not run the vitest suite locally without rewriting the lockfile. This is a one-line formatting change and the spec was updated to mirror it, so CI should cover it. Happy to tweak the column label or approach if you would prefer something else.Summary by CodeRabbit