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

Commit 4994acd

Browse files
fix(filters): ensure formatNumber observes i18n decimal separators
Closes #10342 Closes #12850
1 parent 4dd10fd commit 4994acd

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/ng/filter/filters.js

+1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
214214
if (fractionSize > 0 && number < 1) {
215215
formatedText = number.toFixed(fractionSize);
216216
number = parseFloat(formatedText);
217+
formatedText = formatedText.replace(DECIMAL_SEP, decimalSep);
217218
}
218219
}
219220

test/ng/filter/filtersSpec.js

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ describe('filters', function() {
6262
it('should format according different separators', function() {
6363
var num = formatNumber(1234567.1, pattern, '.', ',', 2);
6464
expect(num).toBe('1.234.567,10');
65+
num = formatNumber(1e-14, pattern, '.', ',', 14);
66+
expect(num).toBe('0,00000000000001');
6567
});
6668

6769
it('should format with or without fractionSize', function() {

0 commit comments

Comments
 (0)