Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
9e45589085 | |||
3c93d07124 |
10
CHANGELOG.md
10
CHANGELOG.md
@ -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>
|
<a name="6.0.8"></a>
|
||||||
## [6.0.8](https://github.com/angular/angular/compare/6.0.7...6.0.8) (2018-07-11)
|
## [6.0.8](https://github.com/angular/angular/compare/6.0.7...6.0.8) (2018-07-11)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "angular-srcs",
|
"name": "angular-srcs",
|
||||||
"version": "6.0.8",
|
"version": "6.0.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"branchPattern": "2.0.*",
|
"branchPattern": "2.0.*",
|
||||||
"description": "Angular - a web framework for modern web apps",
|
"description": "Angular - a web framework for modern web apps",
|
||||||
|
@ -193,20 +193,9 @@ function padNumber(
|
|||||||
return neg + strNum;
|
return neg + strNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
function formatFractionalSeconds(milliseconds: number, digits: number): string {
|
||||||
* Trim a fractional part to `digits` number of digits.
|
const strMs = padNumber(milliseconds, 3);
|
||||||
* Right pads with "0" to fit the requested number of digits if needed.
|
return strMs.substr(0, digits);
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -226,7 +215,7 @@ function dateGetter(
|
|||||||
part = 12;
|
part = 12;
|
||||||
}
|
}
|
||||||
} else if (name === DateType.FractionalSeconds) {
|
} else if (name === DateType.FractionalSeconds) {
|
||||||
return trimRPadFractional(part, size);
|
return formatFractionalSeconds(part, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
const localeMinus = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
|
const localeMinus = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
|
||||||
|
@ -319,6 +319,10 @@ describe('Format date', () => {
|
|||||||
expect(formatDate(3000, 'm:ss.S', 'en')).toEqual('0:03.0');
|
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.SS', 'en')).toEqual('0:03.00');
|
||||||
expect(formatDate(3000, 'm:ss.SSS', 'en')).toEqual('0:03.000');
|
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');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user