Skip to content

Commit

Permalink
fix(datepicker): fix SimpleChanges issue, add date check (#2223)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaSurmay authored and valorkin committed Jul 19, 2017
1 parent 4a37406 commit 501d878
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/datepicker/datepicker-inner.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 501d878

Please sign in to comment.