profile
viewpoint

Ask questionsNumeral.js with locale reports undefined

I tried the current version for using locales in TextFormat with numbers. Unfortunately this does not work, because of missing local definition in Numeral.js. I found breaking changes in version 2.0.0 in Numeral. The locales will not be loaded automatically. I wrote my own TextFormat and imported all the locales I need import 'numeral/locales/de I don't know how to dynamically import the locales in react and typescript and I think it is not a good solution to import all.

see also #42

jhipster/react-jhipster

Answer questions oerd

I wrote a PR against Numeral.js adding a locale I'm interested in and noticed that Numeral.js has not been updated for a long time. It should be safe to say it's been dismissed.

There is a fork called Numbrojs, maybe we could rewrite TextFormat to use Numbro instead of Numeral. Here is a comparison of both https://www.npmtrends.com/numeral-vs-numbro (numeral is used more due to having existed earlier).

My strong belief is that pulling in another library for this is overkill. The "built-in" NumberFormat should cover most formatting cases.

useful!

Related questions

No questions were found.
Github User Rank List