react-native-format-currency icon indicating copy to clipboard operation
react-native-format-currency copied to clipboard

Request for Option to Format to Currency Decimal Even When Amount Is a Whole Number

Open mrdonchocho opened this issue 3 years ago • 2 comments

Can we have an argument option to format the amount into specified decimal places, pls?

mrdonchocho avatar May 19 '22 11:05 mrdonchocho

@mrdonchocho Can you provide an example, please? Are you asking to be able to specify an arbitrary number of decimals vs. using a particular currency format, i.e., USD = "$xx.yy" (2 decimals), etc.?

btroia avatar May 23 '22 12:05 btroia

I'd like to second the motion.

Regarding mrdonchocho's request, I think he wants to see $100.00 even when the user doesn't specify any cents in the input. I think this is desirable in some circumstances, and would be a good configuration option.

I'm requesting the same thing, essentially, especially in the case where the user wants to specify an amount that is a multiple of $.10. In USD, for example, I would want to see $1,000.50 if somebody merely provided 1000.5 as input. Right now, the library outputs $1,000.5, which isn't correct.

Other similar libraries provide options such as a given precision with which to format numbers to achieve this.

Thanks!

Permusoft avatar Aug 11 '22 18:08 Permusoft