You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
it('should filter exponentially small numbers on non dot decimal separator languages',function(){$locale.NUMBER_FORMATS.DECIMAL_SEP=',';expect(number(1e-50,0)).toEqual('0');expect(number(1e-6,6)).toEqual('0,000001');expect(number(1e-7,6)).toEqual('0,000000');expect(number(-1e-50,0)).toEqual('0');expect(number(-1e-6,6)).toEqual('-0,000001');expect(number(-1e-7,6)).toEqual('-0,000000');});
The .toFixed method is directly use to render the final number. And so, does NOT care about i18n at all.
To solve this issue, I suggest just to replace the dot by the expected decimal separator. As we deal this just number < 1, we don't have to manage thousand group separators.
@evanliomain yes, this is a valid bug. Currently we've got a code-path that calls number.toFixed(fractionSize) to format exponentially small numbers. This is wrong as this code-path completly ignores locale-specific settings.
Sadly the current implementation needs a bit of love to simplify it.
Issue
The number decimal separator are incorrect for the fr-fr locale in formatNumber for exponentially small numbers.
Expected
Actual
In fact, it's an issue for all languages that do not have a dot as decimal separator.
I suggest the same use case than "should filter exponentially small numbers" to test this issue:
Solve suggestion
I figure out where the issue is localized: https://github.com/angular/angular.js/blob/g3_v1_3/src/ng/filter/filters.js#L206
The
.toFixed
method is directly use to render the final number. And so, does NOT care about i18n at all.To solve this issue, I suggest just to replace the dot by the expected decimal separator. As we deal this just number < 1, we don't have to manage thousand group separators.
The text was updated successfully, but these errors were encountered: