Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(datepicker): fix SimpleChanges issue, add date check #2223

Merged
merged 1 commit into from
Jul 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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