Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix currency rounding #524

Merged
merged 3 commits into from
Jan 29, 2025
Merged

Conversation

Duddino
Copy link
Member

@Duddino Duddino commented Jan 23, 2025

Abstract

The integer part of the currency was always being rounded to the nearest integer of the whole number.
Basically '2.6' was being displayed as '3.6'. This is because we were treating the integer part and the decimals separately

This PR adds unit testing to the beautifyNumber function and makes it handle currency as well.
This PR also respects currency digits, e.g. sats have no decimals, or USD have 2
Thanks to @EricStanek for pointing this out

Testing

  • Test that currencies with 0.5 <= decimals < 1 are displayed properly
  • Test that satoshis aren't displayed with decimals

@Duddino Duddino self-assigned this Jan 23, 2025
Copy link

netlify bot commented Jan 23, 2025

Deploy Preview for cheery-moxie-4f1121 ready!

Name Link
🔨 Latest commit f9a8953
🔍 Latest deploy log https://app.netlify.com/sites/cheery-moxie-4f1121/deploys/67920f4f3bb42a000819e60e
😎 Deploy Preview https://deploy-preview-524--cheery-moxie-4f1121.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@JSKitty JSKitty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK f9a8953

Looking nice! Compared 1:1 under various currency configurations against Prod.

@Duddino Duddino merged commit 7751506 into PIVX-Labs:master Jan 29, 2025
6 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