fix(datePipe): allow float for date pipe input (#10687)
This commit is contained in:
parent
e9479b30e8
commit
712c7d5c3b
|
@ -104,7 +104,7 @@ export class DatePipe implements PipeTransform {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NumberWrapper.isNumeric(value)) {
|
if (NumberWrapper.isNumeric(value)) {
|
||||||
value = DateWrapper.fromMillis(NumberWrapper.parseInt(value, 10));
|
value = DateWrapper.fromMillis(parseFloat(value));
|
||||||
} else if (isString(value)) {
|
} else if (isString(value)) {
|
||||||
value = DateWrapper.fromISOString(value);
|
value = DateWrapper.fromISOString(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,9 @@ export function main() {
|
||||||
it('should support numeric strings',
|
it('should support numeric strings',
|
||||||
() => { expect(() => pipe.transform('123456789')).not.toThrow(); });
|
() => { expect(() => pipe.transform('123456789')).not.toThrow(); });
|
||||||
|
|
||||||
|
it('should support decimal strings',
|
||||||
|
() => { expect(() => pipe.transform('123456789.11')).not.toThrow(); });
|
||||||
|
|
||||||
it('should support ISO string',
|
it('should support ISO string',
|
||||||
() => { expect(() => pipe.transform('2015-06-15T21:43:11Z')).not.toThrow(); });
|
() => { expect(() => pipe.transform('2015-06-15T21:43:11Z')).not.toThrow(); });
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue