Skip to content

Commit c7f21bf

Browse files
author
Tobias Schweizer
committed
refactor (MatCalendarHeader): make calendar private for custom header
1 parent a33b70c commit c7f21bf

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/demo-app/datepicker/datepicker-demo.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,24 @@ export class DatepickerDemo {
6060
`
6161
})
6262
export class CustomHeader {
63-
constructor(@Host() public calendar: MatCalendar<any>,
63+
constructor(@Host() private _calendar: MatCalendar<any>,
6464
private _dateAdapter: DateAdapter<any>) {}
6565

6666
get periodLabel() {
67-
let year = this._dateAdapter.getYearName(this.calendar.activeDate);
68-
let month = (this._dateAdapter.getMonth(this.calendar.activeDate) + 1);
67+
let year = this._dateAdapter.getYearName(this._calendar.activeDate);
68+
let month = (this._dateAdapter.getMonth(this._calendar.activeDate) + 1);
6969
return `${month}/${year}`;
7070
}
7171

7272
previousClicked(mode: 'month' | 'year') {
73-
this.calendar.activeDate = mode == 'month' ?
74-
this._dateAdapter.addCalendarMonths(this.calendar.activeDate, -1) :
75-
this._dateAdapter.addCalendarYears(this.calendar.activeDate, -1);
73+
this._calendar.activeDate = mode == 'month' ?
74+
this._dateAdapter.addCalendarMonths(this._calendar.activeDate, -1) :
75+
this._dateAdapter.addCalendarYears(this._calendar.activeDate, -1);
7676
}
7777

7878
nextClicked(mode: 'month' | 'year') {
79-
this.calendar.activeDate = mode == 'month' ?
80-
this._dateAdapter.addCalendarMonths(this.calendar.activeDate, 1) :
81-
this._dateAdapter.addCalendarYears(this.calendar.activeDate, 1);
79+
this._calendar.activeDate = mode == 'month' ?
80+
this._dateAdapter.addCalendarMonths(this._calendar.activeDate, 1) :
81+
this._dateAdapter.addCalendarYears(this._calendar.activeDate, 1);
8282
}
8383
}

0 commit comments

Comments
 (0)