Skip to content

Commit 1ebf719

Browse files
committed
addressed comments
1 parent bde0170 commit 1ebf719

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
@@ -296,6 +296,14 @@ describe('NativeDateAdapter', () => {
296296
new Date(2018, FEB, 1), new Date(2018, JAN, 1), new Date(2019, JAN, 1)))
297297
.toEqual(new Date(2018, FEB, 1));
298298
});
299+
300+
it('should count a Date as a date object', () => {
301+
expect(adapter.isDateObject(new Date())).toBe(true);
302+
});
303+
304+
it('should not count a string as a date object', () => {
305+
expect(adapter.isDateObject('1/1/2017')).toBe(false);
306+
});
299307
});
300308

301309

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)