Skip to content

Fix cashback value formatting to preserve decimal precision#2046

Merged
MusabShakeel576 merged 1 commit into
qafrom
claude/fix-cashback-display-nRYlP
May 5, 2026
Merged

Fix cashback value formatting to preserve decimal precision#2046
MusabShakeel576 merged 1 commit into
qafrom
claude/fix-cashback-display-nRYlP

Conversation

@MusabShakeel576
Copy link
Copy Markdown
Contributor

Summary

Updated cashback value formatting in the card details component to maintain two decimal places consistently, improving precision and display accuracy for monetary values.

Key Changes

  • Modified SpendingBalanceCard component to return cashback total USD value as a string with 2 decimal places (toFixed(2)) instead of parsing to a number with 0 decimal places
  • Modified CashbackDisplay component with the same formatting fix for consistency
  • Changed fallback value from 0 to '0.00' to match the new string format with proper decimal precision

Implementation Details

  • The changes ensure that cashback values are displayed with exactly 2 decimal places, which is the standard for currency formatting
  • By keeping the value as a string (via toFixed(2)), we preserve the decimal precision without floating-point arithmetic issues
  • This maintains consistency across both components that display cashback information

https://claude.ai/code/session_01KbGt2z23Ci4FWrvDcC8pEc

The desktop SpendingBalanceCard was rounding totalUsdValue to whole dollars
via .toFixed(0), so any cashback under $0.50 rendered as "$0". The mobile
CashbackDisplay used .toFixed(2) but then parseFloat-ed it back to a number,
dropping trailing zeros (e.g. "$0.30" rendered as "$0.3"). Format both as
"$X.XX" strings.

https://claude.ai/code/session_01KbGt2z23Ci4FWrvDcC8pEc
@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
solid-app Ignored Ignored May 5, 2026 8:15am
solid-app-staging Ignored Ignored May 5, 2026 8:15am

Request Review

@MusabShakeel576 MusabShakeel576 merged commit cc6974a into qa May 5, 2026
4 of 5 checks passed
@MusabShakeel576 MusabShakeel576 deleted the claude/fix-cashback-display-nRYlP branch May 5, 2026 08:18
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