diff --git a/src/datepicker/datepicker-inner.component.ts b/src/datepicker/datepicker-inner.component.ts index cb3321ed59..4d95075cb7 100644 --- a/src/datepicker/datepicker-inner.component.ts +++ b/src/datepicker/datepicker-inner.component.ts @@ -105,17 +105,17 @@ export class DatePickerInnerComponent implements OnInit, OnChanges { // tslint:disable-next-line:no-unused-variable public ngOnChanges(changes: SimpleChanges): void { this.refreshView(); - this.checkIfActiveDateGotUpdated(changes.activeDate); + this.checkIfActiveDateGotUpdated(changes['activeDate']); } - - //Check if activeDate has been update and then emit the activeDateChange with the new date + + // Check if activeDate has been update and then emit the activeDateChange with the new date private checkIfActiveDateGotUpdated(activeDate: any): void { if (activeDate && !activeDate.firstChange) { let previousValue = activeDate.previousValue; - if (previousValue && previousValue.getTime() !== activeDate.currentValue.getTime()) { + if (previousValue && previousValue instanceof Date && previousValue.getTime() !== activeDate.currentValue.getTime()) { this.activeDateChange.emit(this.activeDate); } - } + } } public setCompareHandler(handler: Function, type: string): void {