react-number-input
react-number-input copied to clipboard
numeral is neither exposed nor setting numeral.language is allowed
The defaults of numeral are not useful, and there is currently no way to set numeral.language
E.g.
var french = {
delimiters: {
thousands: ' ',
decimal: ','
},
...
};
<NumberInput
numeralLang={french} ...
At the moment numeral js only supports setting the language globally rather than per use. They have a few open issues about this but can't see anything about whether it is going to be added any time soon.
Are you after different locale settings per number input component or more on a application scale?
It would probably end up looking something like the below rather than as a property of the number input component I would imagine:
import NumberInput, {locale} from 'react-number-input'
locale('fr')
I'm not sure if this approach is the best though as you'd now have this affecting every component in your application no matter where this was set.
I've created a PR for this with numeral js though I'm getting the feeling it isn't too well supported these days. Will keep an eye on it and see if there is any movement.
But basically it allows for setting the language per format rather than globally.
Once merged, can update this this to allow for different locale settings.
This is on the TODO list, and seems like @dwendo is on it :+1: