Skip to content
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 opened this issue Mar 21, 2016 · 0 comments
Closed

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

owencraig opened this issue Mar 21, 2016 · 0 comments

Comments

@owencraig
Copy link
Contributor

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

owencraig pushed a commit to owencraig/angular.js that referenced this issue Mar 21, 2016
… lgSize

By using >= when comparing the number length to the lgSize we'll provide
the correct value when formatting numbers with differing lgSize and gSize

Closes angular#14289
owencraig added a commit to owencraig/angular.js that referenced this issue Mar 21, 2016
… lgSize

By using >= when comparing the number length to the lgSize we'll provide
the correct value when formatting numbers with differing lgSize and gSize

Closes angular#14289
@gkalpak gkalpak added this to the 1.5.3 milestone Mar 21, 2016
gkalpak pushed a commit that referenced this issue Mar 21, 2016
…gSize`

By using `>=` when comparing the number length to `lgSize`, we'll provide the correct value, when
formatting numbers with different `lgSize` than `gSize`.

Fixes #14289

Closes #14290
gkalpak pushed a commit that referenced this issue Mar 21, 2016
…gSize`

By using `>=` when comparing the number length to `lgSize`, we'll provide the correct value, when
formatting numbers with different `lgSize` than `gSize`.

Fixes #14289

Closes #14290
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants