Numeral-js
Numeral-js copied to clipboard
Set locale on single instance
Seems like the locale can only be set globally, e.g. numeral.locale('it')
. This may cause problems with async callbacks causing them to pick the wrong locale, if multiple locales are involved.
It should be possibile to set the locale for a single instance, e.g.
numeral(3.14).locale('it').format('0,00.00');
I agree!!
That, as well as other global settings like zeroFormat
, defaultFormat
, etc.
@adamwdraper any feedback on this?
I guess this lib is only suitable for front end. Can't find a way to have multiple instances of numeral in node. Any clue?
I'm also hitting this issue on an api server. I'd like to just set locale() specifically for each request and not have it globally affect all other requests.
This is also a blocker in front end... I have data coming from different inputs for the same user and I need to parse those numbers using different locales and render them with the same format.
Has anyone found another library for this issue? I'm using it in the backend and need to use a fixed locale per request.