You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'd like to more easily & accurately identify the user's preferred number format, to use when formatting numbers in my app to match this.
Describe the solution you'd like
I'd like to see NativeScript's Device class contain a numberFormat property to expose their OS-level user preference:
Identifying the user's preference is the goal here; not actually reformatting of numbers. Once I have that, I can handle formatting numbers within my app to match their preference.
From iOS Settings -> General -> Language & Region -> Number Format:
I've considered npm's Intl class, but it hasn't been updated in 8 years, and I found errors, shockingly, even in the current NodeJS Intl class for thousands and fractional separators for certain regions. This class is also not consistent with iOS's number formatting for certain regions.
I ended up using a Node script to create base data set of thousands and fractional separators, and then manually correcting and handling scenarios such as french-speaking Canada vs English speaking Canada.
However, all of the above are error prone, require maintenance, and are not guaranteed to respect/match the user's system-level preference on iOS.
The ideal solution would be to get this from the user's iOS system preferences, so we can format it to what the user expects.
Appreciate it; I created my own temporary solution.
For clarity for the maintainers, this issue about getting the preferred number format from the user's device settings--i.e. just knowing what their preferred format is, not about implementing a function to format numbers to it.
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
I'd like to more easily & accurately identify the user's preferred number format, to use when formatting numbers in my app to match this.
Describe the solution you'd like
I'd like to see NativeScript's Device class contain a numberFormat property to expose their OS-level user preference:
Identifying the user's preference is the goal here; not actually reformatting of numbers. Once I have that, I can handle formatting numbers within my app to match their preference.
From iOS Settings -> General -> Language & Region -> Number Format:

Describe alternatives you've considered
I've tried:
Intl.NumberFormatter
in NativeScript (v8.7.2), but it is broken and always uses a comma thousands separator. The Intl class is not supported currently apparently.Intl
class, but it hasn't been updated in 8 years, and I found errors, shockingly, even in the current NodeJS Intl class for thousands and fractional separators for certain regions. This class is also not consistent with iOS's number formatting for certain regions.However, all of the above are error prone, require maintenance, and are not guaranteed to respect/match the user's system-level preference on iOS.
The ideal solution would be to get this from the user's iOS system preferences, so we can format it to what the user expects.
Anything else?
No response
Please accept these terms
The text was updated successfully, but these errors were encountered: