Code Monkey home page Code Monkey logo

Comments (7)

robisim74 avatar robisim74 commented on September 23, 2024

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.

from angular-l10n.

ihor-zinchenko avatar ihor-zinchenko commented on September 23, 2024

@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

from angular-l10n.

robisim74 avatar robisim74 commented on September 23, 2024

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

from angular-l10n.

ihor-zinchenko avatar ihor-zinchenko commented on September 23, 2024

@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?

from angular-l10n.

robisim74 avatar robisim74 commented on September 23, 2024

{{ value | l10nNumber:'en':{ digits: '1.0-0', style: 'decimal' } }}

from angular-l10n.

ihor-zinchenko avatar ihor-zinchenko commented on September 23, 2024

@robisim74 thanks!)) you save my time!)

from angular-l10n.

robisim74 avatar robisim74 commented on September 23, 2024

Ok, note that if your value is an integer, you can just use:

{{ value | l10nNumber:'en'}}

Greetings

from angular-l10n.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.