Skip to content

Currency pipe, digits info with either 0 or 2 decimals (but not 1) #27391

Closed
@WanderG

Description

@WanderG

🚀 feature request

Relevant Package

This feature request is for @angular/common

Description

In many use cases where showing currency, it looks better to not show any decimals when there aren't any to show. So "€100" instead of "€100.00". However when the price is 99.99 you do want to show the decimals. What you don't want is when the price is 99.90, to have it shown as 99.9.

This means that none of the number formats "1,0", "1.2" or "1.0-2" have the desired effect.

Describe the solution you'd like

To be able to specify 2 options for decimals, for instance: "1.0|2".

So that:

  • 1.0 | currency : 'EUR' : 'symbol' : '1.0|2' -> €1
  • 1.1 | currency : 'EUR' : 'symbol' : '1.0|2' -> €1.10
  • 1.11 | currency : 'EUR' : 'symbol' : '1.0|2' -> €1.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: i18nIssues related to localization and internationalizationfeatureIssue that requests a new feature

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions