-
-
Notifications
You must be signed in to change notification settings - Fork 325
Description
Is your feature request related to a problem? Please describe.
The number formatter in this package allows number
or bigint
input only.
When working with very larger numbers, we typically use other libraries that can deal with high precision. However, in order to use next-intl
number formatter, we have to turn those numbers back into native number values, which would be lossy and produce incorrect values.
Describe the solution you'd like
Intl.NumberFormat
already supports a string
param that it can then format losslessly in modern browsers. Seeing how we delegate to this library anyway, it would be good to broaden the type of number()
function.
This way we can pass large numbers as string to the formatter and get a correct representation out.
Describe alternatives you've considered
My workaround is to just get the locale and do my own Intl.NumberFormat
formatter. But then I have to forego or re-implement all the nice locale-awareness and caching that next-intl
has already got.