Skip to content
Permalink
Browse files

fix(filters): ensure `formatNumber` observes i18n decimal separators

Closes #10342
Closes #12850
  • Loading branch information...
petebacondarwin committed Sep 14, 2015
1 parent f8cf28a commit 658a865c5b2580eed53b340e7394945cd76e2260
Showing with 3 additions and 0 deletions.
  1. +1 −0 src/ng/filter/filters.js
  2. +2 −0 test/ng/filter/filtersSpec.js
@@ -214,6 +214,7 @@ function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
if (fractionSize > 0 && number < 1) {
formatedText = number.toFixed(fractionSize);
number = parseFloat(formatedText);
formatedText = formatedText.replace(DECIMAL_SEP, decimalSep);
}
}

@@ -62,6 +62,8 @@ describe('filters', function() {
it('should format according different separators', function() {
var num = formatNumber(1234567.1, pattern, '.', ',', 2);
expect(num).toBe('1.234.567,10');
num = formatNumber(1e-14, pattern, '.', ',', 14);
expect(num).toBe('0,00000000000001');
});

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

0 comments on commit 658a865

Please sign in to comment.
You can’t perform that action at this time.