Skip to content

Commit ee6fa4a

Browse files
committed
fix(IgxMonthPicker): error should not be thown when press arrowLeft #8074
1 parent f8f3c39 commit ee6fa4a

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

projects/igniteui-angular/src/lib/calendar/month-picker/month-picker.component.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export class IgxMonthPickerComponent extends IgxMonthPickerBaseDirective {
153153
public changeYearKB(event, next = true) {
154154
if (event.key === KEYS.SPACE || event.key === KEYS.SPACE_IE || event.key === KEYS.ENTER) {
155155
event.stopPropagation();
156-
next ? this.nextYear(event) : this.previousYear(event);
156+
next ? this.nextYear() : this.previousYear();
157157
}
158158
}
159159

@@ -188,8 +188,6 @@ export class IgxMonthPickerComponent extends IgxMonthPickerBaseDirective {
188188
if (!value) {
189189
return new Date();
190190
}
191-
192-
// TO DO: to be refactored after discussion on the desired behavior
193191
super.selectDate(value);
194192
this.viewDate = value;
195193
}
@@ -198,8 +196,6 @@ export class IgxMonthPickerComponent extends IgxMonthPickerBaseDirective {
198196
* @hidden
199197
*/
200198
public writeValue(value: Date) {
201-
202-
// TO DO: to be refactored after discussion on the desired behavior
203199
if (value) {
204200
this.viewDate = this.selectedDates = value;
205201
}
@@ -211,7 +207,7 @@ export class IgxMonthPickerComponent extends IgxMonthPickerBaseDirective {
211207
@HostListener('keydown.pageup', ['$event'])
212208
public previousYear(event?: KeyboardEvent) {
213209
event?.preventDefault();
214-
if (this.yearAction === 'next') { return; }
210+
if (event && this.yearAction === 'next') { return; }
215211
this.yearAction = 'prev';
216212
this.previousViewDate = this.viewDate;
217213
this.viewDate = this.calendarModel.getPrevYear(this.viewDate);
@@ -223,7 +219,7 @@ export class IgxMonthPickerComponent extends IgxMonthPickerBaseDirective {
223219
@HostListener('keydown.pagedown', ['$event'])
224220
public nextYear(event?: KeyboardEvent) {
225221
event?.preventDefault();
226-
if (this.yearAction === 'prev') { return; }
222+
if (event && this.yearAction === 'prev') { return; }
227223
this.yearAction = 'next';
228224
this.previousViewDate = this.viewDate;
229225
this.viewDate = this.calendarModel.getNextYear(this.viewDate);

0 commit comments

Comments
 (0)