Format dollars only when cents are 0
See original GitHub issueSuppose I have precision=2 in dollars. However when the value is whole dollars, it is overwhelming for the user to see $50.00
, instead of just $50
.
I propose adding yet another config option to indicate whether currency.js
should do such formatting. For example: { omitZeroCents: true }
.
If this proposal sounds well, I am willing to make a PR. Thanks
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Format numbers as currency - Microsoft Support
In the Symbol box, click the currency symbol that you want. Note: If you want to display a monetary value without a currency...
Read more >c# - String.Format way to format Currency without Cents
We will be dealing with large dollar amounts, and no cents. We would like the currency to display as $10 without the decimal...
Read more >How to Format Money in General Writing
Just as everyone handles money differently, you can format money differently depending on ... Spell out references to dollars and cents without numerals.1....
Read more >How To Write Dollars and Cents on a Check - The Balance
You might have noticed that the last example was for less than one dollar. To write a check for less than a full...
Read more >Is there a custom format in excel to show cents values without ...
How about multiplying your value by 100, then using your format with a space in place of the decimal point. Of course, you'd...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
v2.0.0
has just been released where the formatter can now be a function allowing you to customize the output formatting (see https://github.com/scurker/currency.js/issues/191#issuecomment-529201820) for exampleThanks a lot! Will look it up, and probably migrate. Kudos for the good work.