Closed ihor-zinchenko closed 3 years ago
Hi @ihor-zinchenko ,
this library uses Intl API. About the thousands separator, Intl API uses the standard for each language:
Intl.NumberFormat('en').format(16584)
"16,584"
Intl.NumberFormat('da').format(16584)
"16.584"
Intl.NumberFormat('fr').format(16584)
"16 584"
and you can use options to customize the behavior: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat
But for different thousands separator there is not an option (you can only disable it): you have to build your own custom formatter.
@robisim74 great thanks!) and one more, tell me please how i can set language for pipe? For example
{{ value | l10nNumber:locale.language:{ digits: '1.2-2', style: 'number' } }}
``` and i want to use english format, for example 16888 should be 16.888
If you want force the pipe to use only english, just put:
{{ value | l10nNumber:'en':{ digits: '1.2-2', style: 'number' } }}
but the standard english format for thousand separator is comma: 16,888
, not 16.888
@robisim74 i tried but style: number is incorrect
{{ value | l10nNumber:'en':{ digits: '1.2-2', style: 'decimal' } }}
Decimal works but one more) it display like that: 16888 -> 16,888.00, can you tell me how i can remove .00?
{{ value | l10nNumber:'en':{ digits: '1.0-0', style: 'decimal' } }}
@robisim74 thanks!)) you save my time!)
Ok, note that if your value is an integer, you can just use:
{{ value | l10nNumber:'en'}}
Greetings
Hi! I need to implement custom number format options, how i can do that? Can you provide any example? For example i have search with 16584 results and i need transform it to 16.584 for English and Danish and for example 16 584 for French