react-number-format icon indicating copy to clipboard operation
react-number-format copied to clipboard

Format function should support decimal

Open wapgear opened this issue 5 years ago • 2 comments

On our project we had a problem with your library - for some reason with typeof props.format === "function" library worked only with integers, with this PR it'll also support decimal values.

wapgear avatar Jul 25 '19 13:07 wapgear

@s-yadav hey sorry if I disturb you but what do you think about this?

wapgear avatar Aug 05 '19 12:08 wapgear

I don't think we should handle prefix / suffix, and other formatting props if format prop is defined as function. If we do so that will lead to lots of corner case which is not meant to be solved by here.

We can look for some regex instead which allows all the valid character of a number and let the format method handle the cases.

Also, If a user needs to have more control on removing formatting he can pass removeFormat method. I guess we can work on improving the documentation of format (as function) and removeFormatting method, so people are aware of it while using custom format function. What do you say?

s-yadav avatar Aug 05 '19 18:08 s-yadav