Skip to content

Commit a72104c

Browse files
committed
addressed comments
1 parent 3940c0d commit a72104c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/lib/core/datetime/native-date-adapter.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,14 @@ describe('NativeDateAdapter', () => {
304304
expect(adapter.format(new Date(1800, 7, 14), {day: 'numeric'})).toBe('Thu Aug 14 1800');
305305
}
306306
});
307+
308+
it('should count a Date as a date object', () => {
309+
expect(adapter.isDateObject(new Date())).toBe(true);
310+
});
311+
312+
it('should not count a string as a date object', () => {
313+
expect(adapter.isDateObject('1/1/2017')).toBe(false);
314+
});
307315
});
308316

309317

src/lib/datepicker/datepicker-input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export class MdDatepickerInput<D> implements AfterContentInit, ControlValueAcces
117117
}
118118
set value(value: D | null) {
119119
if (value != null && !this._dateAdapter.isDateObject(value)) {
120-
throw new Error('Datepicker: value not recognized as a date object by DateAdapter.');
120+
throw Error('Datepicker: value not recognized as a date object by DateAdapter.');
121121
}
122122
let oldDate = this.value;
123123
this._renderer.setProperty(this._elementRef.nativeElement, 'value',

0 commit comments

Comments
 (0)