Skip to content

Commit 74eeda2

Browse files
committed
fix(calendar): keep track of month changes #4282
1 parent 7bc95a5 commit 74eeda2

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

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

+2-22
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import {
1010
ElementRef,
1111
AfterViewInit,
1212
ViewChildren,
13-
QueryList,
14-
AfterViewChecked
13+
QueryList
1514
} from '@angular/core';
1615
import { NG_VALUE_ACCESSOR } from '@angular/forms';
1716
import { fadeIn, scaleInCenter } from '../animations/main';
@@ -70,7 +69,7 @@ export interface IMonthView {
7069
selector: 'igx-calendar',
7170
templateUrl: 'calendar.component.html'
7271
})
73-
export class IgxCalendarComponent extends IgxMonthPickerBase implements AfterViewInit, AfterViewChecked {
72+
export class IgxCalendarComponent extends IgxMonthPickerBase implements AfterViewInit {
7473
/**
7574
* Sets/gets the `id` of the calendar.
7675
* If not set, the `id` will have value `"igx-calendar-0"`.
@@ -388,15 +387,6 @@ export class IgxCalendarComponent extends IgxMonthPickerBase implements AfterVie
388387
});
389388
}
390389

391-
public ngAfterViewChecked() {
392-
this.monthViews.forEach((item, index) => {
393-
const prevMonthView = this.getMonthView(index - 1);
394-
const nextMonthView = this.getMonthView(index + 1);
395-
item.nextMonthView = nextMonthView;
396-
item.prevMonthView = prevMonthView;
397-
});
398-
}
399-
400390
/**
401391
* Returns the locale representation of the month in the month view if enabled,
402392
* otherwise returns the default `Date.getMonth()` value.
@@ -415,9 +405,6 @@ export class IgxCalendarComponent extends IgxMonthPickerBase implements AfterVie
415405
*/
416406
public previousMonth(isKeydownTrigger = false) {
417407
this.viewDate = this.calendarModel.timedelta(this.viewDate, 'month', -1);
418-
// this.dayViews.forEach((val) => {
419-
// val.viewDate = this.calendarModel.timedelta(val.viewDate, 'month', -1);
420-
// });
421408
this._monthAction = 'prev';
422409

423410
if (this.daysView) {
@@ -430,9 +417,6 @@ export class IgxCalendarComponent extends IgxMonthPickerBase implements AfterVie
430417
*/
431418
public nextMonth(isKeydownTrigger = false) {
432419
this.viewDate = this.calendarModel.timedelta(this.viewDate, 'month', 1);
433-
// this.dayViews.forEach((val) => {
434-
// val.viewDate = this.calendarModel.timedelta(val.viewDate, 'month', 1);
435-
// });
436420
this._monthAction = 'next';
437421

438422
if (this.daysView) {
@@ -558,10 +542,6 @@ export class IgxCalendarComponent extends IgxMonthPickerBase implements AfterVie
558542
*/
559543
public changeMonth(event: Date) {
560544
this.viewDate = new Date(this.viewDate.getFullYear(), event.getMonth());
561-
// this.dayViews.forEach((val, index) => {
562-
// // val.viewDate.setMonth(event.getMonth() + index);
563-
// val.viewDate = this.calendarModel.timedelta(val.viewDate, 'month', index);
564-
// });
565545

566546
this.activeView = CalendarView.DEFAULT;
567547

0 commit comments

Comments
 (0)