Format function should support decimal#327
Conversation
|
@s-yadav hey sorry if I disturb you but what do you think about this? |
| val = removeFormatting(val); | ||
| } else { | ||
| val = (val.match(/\d/g) || []).join('') | ||
| val = this.removePrefixAndSuffix(val); |
There was a problem hiding this comment.
We should not handle other formatting props, when format function is provided.
|
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. |
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.