s-yadav / react-number-format

React component to format numbers in an input or as a text.
MIT License
3.9k stars 410 forks source link

Can't add decimal and cents using NumberFormatBase and Intl.NumberFormat #781

Open NwosaEmeka opened 1 year ago

NwosaEmeka commented 1 year ago

I have been trying to format my currency input to have decimal and cents values but it's not being accepted. I'm using the example in the documentation here https://codesandbox.io/s/custom-numeric-format-ovl6km?from-embed.

I want my input to be of this value $100.25 but so far unable to do so and it seems format has been removed from NumericFormat

I would appreciate a help on this

s-yadav commented 1 year ago

Isn't NumericFormat helpful. to you? Seems like whatever you mentioned is already covered on NumericFormat. However if you have very specific need, you can patch format method coming from useNumericFormat hook. See this example. https://s-yadav.github.io/react-number-format/docs/customization#custom-numeral-example