We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e24d968 commit 5266490Copy full SHA for 5266490
src/ng/filter/filters.js
@@ -459,7 +459,7 @@ function dateFilter($locale) {
459
date = new Date(date);
460
}
461
462
- if (!isDate(date)) {
+ if (!isDate(date) || !isFinite(date.getTime())) {
463
return date;
464
465
test/ng/filter/filtersSpec.js
@@ -247,6 +247,11 @@ describe('filters', function() {
247
expect(date('')).toEqual('');
248
});
249
250
+ it('should ignore invalid dates', function() {
251
+ var invalidDate = new Date('abc');
252
+ expect(date(invalidDate)).toBe(invalidDate);
253
+ });
254
+
255
it('should do basic filter', function() {
256
expect(date(noon)).toEqual(date(noon, 'mediumDate'));
257
expect(date(noon, '')).toEqual(date(noon, 'mediumDate'));
0 commit comments