From 501d878bc5acd74738d03187e43beabb075705a5 Mon Sep 17 00:00:00 2001 From: Ilya Surmay Date: Wed, 19 Jul 2017 17:19:13 +0300 Subject: [PATCH] fix(datepicker): fix SimpleChanges issue, add date check (#2223) --- src/datepicker/datepicker-inner.component.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 {