Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

formatNumber doesn't handle short numbers correctly in some locales #14289

Closed
@owencraig

Description

@owencraig

Do you want to request a feature or report a bug?
Bug

What is the current behavior?

When using a locale such a ta-in which has an lgSize of 3 and a gSize of 2 (i.e.. ##,##,##0) and a number is sent to the filter with a length equal to the lgSize (e.g. 100) then it is being grouped with the gSize.

E.g.
100000 => 1,00,000
1000 => 1,000
100 => 1,00

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (template: http://plnkr.co/edit/tpl:yBpEi4).

http://plnkr.co/edit/wpJezypsNj7EnatSruKI

What is the expected behavior?

Smaller numbers on the cusp of the lgSize should be formatted as the lgSize e.g in ta-in 100 => 100

What is the motivation / use case for changing the behavior?

Correcting a regression

Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.

This affects all browsers and is present in angular 1.4.9 and 1.4.10. It appears to have been introduced by the changes that landed in 9c49eb1

Other information (e.g. stacktraces, related issues, suggestions how to fix)
Pull request incoming

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions