fix(common): DatePipe parses input string if it's not a valid date in browser (#13895)

Closes #12334
Closes #13874

PR Close #13895
This commit is contained in:
Dzmitry Shylovich
2017-01-30 21:44:19 +03:00
committed by Miško Hevery
parent 9d2c71269b
commit 093cc04748
2 changed files with 41 additions and 6 deletions

View File

@ -59,7 +59,7 @@ export function main() {
() => { expect(() => pipe.transform(isoStringWithoutTime)).not.toThrow(); });
it('should not support other objects',
() => { expect(() => pipe.transform({})).toThrowError(); });
() => expect(() => pipe.transform({})).toThrowError(/Invalid argument/));
});
describe('transform', () => {
@ -190,8 +190,14 @@ export function main() {
});
it('should format invalid in IE ISO date',
() => expect(pipe.transform('2017-01-11T09:25:14.014-0500')).toEqual('Jan 11, 2017'));
it('should format invalid in Safari ISO date',
() => expect(pipe.transform('2017-01-20T19:00:00+0000')).toEqual('Jan 20, 2017'));
it('should remove bidi control characters',
() => { expect(pipe.transform(date, 'MM/dd/yyyy').length).toEqual(10); });
() => expect(pipe.transform(date, 'MM/dd/yyyy').length).toEqual(10));
});
});
}