Compare commits

..

2 Commits
6.0.8 ... 6.0.9

Author SHA1 Message Date
9e45589085 release: cut the v6.0.9 release 2018-07-11 14:34:14 -07:00
3c93d07124 fix(common): format fractional seconds (#24844)
fix a bug introduced in #24831

PR Close #24844
2018-07-11 14:32:33 -07:00
4 changed files with 19 additions and 16 deletions

View File

@ -1,3 +1,13 @@
<a name="6.0.9"></a>
## [6.0.9](https://github.com/angular/angular/compare/6.0.8...6.0.9) (2018-07-11)
### Bug Fixes
* **common:** format fractional seconds ([#24844](https://github.com/angular/angular/issues/24844)) ([3c93d07](https://github.com/angular/angular/commit/3c93d07)), closes [#24831](https://github.com/angular/angular/issues/24831)
<a name="6.0.8"></a>
## [6.0.8](https://github.com/angular/angular/compare/6.0.7...6.0.8) (2018-07-11)

View File

@ -1,6 +1,6 @@
{
"name": "angular-srcs",
"version": "6.0.8",
"version": "6.0.9",
"private": true,
"branchPattern": "2.0.*",
"description": "Angular - a web framework for modern web apps",

View File

@ -193,20 +193,9 @@ function padNumber(
return neg + strNum;
}
/**
* Trim a fractional part to `digits` number of digits.
* Right pads with "0" to fit the requested number of digits if needed.
*
* @param num The fractional part value
* @param digits The width of the output
*/
function trimRPadFractional(num: number, digits: number): string {
let strNum = String(num);
// Add padding at the end
while (strNum.length < digits) {
strNum = strNum + 0;
}
return strNum.substr(0, digits);
function formatFractionalSeconds(milliseconds: number, digits: number): string {
const strMs = padNumber(milliseconds, 3);
return strMs.substr(0, digits);
}
/**
@ -226,7 +215,7 @@ function dateGetter(
part = 12;
}
} else if (name === DateType.FractionalSeconds) {
return trimRPadFractional(part, size);
return formatFractionalSeconds(part, size);
}
const localeMinus = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);

View File

@ -319,6 +319,10 @@ describe('Format date', () => {
expect(formatDate(3000, 'm:ss.S', 'en')).toEqual('0:03.0');
expect(formatDate(3000, 'm:ss.SS', 'en')).toEqual('0:03.00');
expect(formatDate(3000, 'm:ss.SSS', 'en')).toEqual('0:03.000');
expect(formatDate(3001, 'm:ss', 'en')).toEqual('0:03');
expect(formatDate(3001, 'm:ss.S', 'en')).toEqual('0:03.0');
expect(formatDate(3001, 'm:ss.SS', 'en')).toEqual('0:03.00');
expect(formatDate(3001, 'm:ss.SSS', 'en')).toEqual('0:03.001');
});
});
});