fix(datePipe): allow float for date pipe input (#10687)

This commit is contained in:
Andrei Tserakhau 2016-08-14 21:05:21 +04:00 committed by vikerman
parent e9479b30e8
commit 712c7d5c3b
2 changed files with 4 additions and 1 deletions

View File

@ -104,7 +104,7 @@ export class DatePipe implements PipeTransform {
}
if (NumberWrapper.isNumeric(value)) {
value = DateWrapper.fromMillis(NumberWrapper.parseInt(value, 10));
value = DateWrapper.fromMillis(parseFloat(value));
} else if (isString(value)) {
value = DateWrapper.fromISOString(value);
}

View File

@ -36,6 +36,9 @@ export function main() {
it('should support numeric strings',
() => { expect(() => pipe.transform('123456789')).not.toThrow(); });
it('should support decimal strings',
() => { expect(() => pipe.transform('123456789.11')).not.toThrow(); });
it('should support ISO string',
() => { expect(() => pipe.transform('2015-06-15T21:43:11Z')).not.toThrow(); });