Skip to content

Commit

Permalink
fix(datepicker-inner): When changing view on datepicker, and going le…
Browse files Browse the repository at this point in the history
…ft and right, selected date

will stay the same. Not emitting date on move action.
  • Loading branch information
edinfazlic committed Mar 3, 2016
1 parent ae8c617 commit 97c8735
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/datepicker/datepicker-inner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export class DatePickerInner implements OnInit {
private dateFormatter:DateFormatter = new DateFormatter();
private uniqueId:string;
private _activeDate:Date;
private selectedDate:Date;
private _initDate:Date;
private activeDateId:string;
@Input()
Expand Down Expand Up @@ -147,6 +148,7 @@ export class DatePickerInner implements OnInit {
} else {
this.activeDate = new Date();
}
this.selectedDate = new Date(this.activeDate.valueOf());

this.update.emit(this.activeDate);
this.refreshView();
Expand Down Expand Up @@ -227,7 +229,7 @@ export class DatePickerInner implements OnInit {
let dateObject:any = {};
dateObject.date = date;
dateObject.label = this.dateFilter(date, format);
dateObject.selected = this.compare(date, this.activeDate) === 0;
dateObject.selected = this.compare(date, this.selectedDate) === 0;
dateObject.disabled = this.isDisabled(date);
dateObject.current = this.compare(date, new Date()) === 0;
// todo: do it
Expand Down Expand Up @@ -272,6 +274,7 @@ export class DatePickerInner implements OnInit {
this.datepickerMode = this.modes[this.modes.indexOf(this.datepickerMode) - 1];
}

this.selectedDate = new Date(this.activeDate.valueOf());
this.update.emit(this.activeDate);
this.refreshView();
}
Expand All @@ -295,7 +298,6 @@ export class DatePickerInner implements OnInit {
let month = this.activeDate.getMonth() + direction * (expectedStep.months || 0);
this.activeDate.setFullYear(year, month, 1);

this.update.emit(this.activeDate);
this.refreshView();
}
}
Expand Down

0 comments on commit 97c8735

Please sign in to comment.