@@ -52,32 +52,31 @@ export class MatCalendarHeader implements OnDestroy {
52
52
@Optional ( ) private _dateAdapter : DateAdapter < any > ,
53
53
@Optional ( ) @Inject ( MAT_DATE_FORMATS ) private _dateFormats : MatDateFormats ,
54
54
changeDetectorRef : ChangeDetectorRef ) {
55
- _intl . changes . pipe ( takeUntil ( this . _destroyed ) ) . subscribe (
56
- ( ) => changeDetectorRef . markForCheck ( )
57
- ) ;
55
+ _intl . changes . pipe ( takeUntil ( this . _destroyed ) )
56
+ . subscribe ( ( ) => changeDetectorRef . markForCheck ( ) ) ;
58
57
}
59
58
60
59
/** The label for the current calendar view. */
61
60
get periodButtonText ( ) : string {
62
61
if ( this . calendar . currentView == 'month' ) {
63
62
return this . _dateAdapter
64
- . format ( this . calendar . activeDate , this . _dateFormats . display . monthYearLabel )
65
- . toLocaleUpperCase ( ) ;
63
+ . format ( this . calendar . activeDate , this . _dateFormats . display . monthYearLabel )
64
+ . toLocaleUpperCase ( ) ;
66
65
}
67
66
if ( this . calendar . currentView == 'year' ) {
68
67
return this . _dateAdapter . getYearName ( this . calendar . activeDate ) ;
69
68
}
70
69
const activeYear = this . _dateAdapter . getYear ( this . calendar . activeDate ) ;
71
70
const firstYearInView = this . _dateAdapter . getYearName (
72
- this . _dateAdapter . createDate ( activeYear - activeYear % 24 , 0 , 1 ) ) ;
71
+ this . _dateAdapter . createDate ( activeYear - activeYear % 24 , 0 , 1 ) ) ;
73
72
const lastYearInView = this . _dateAdapter . getYearName (
74
- this . _dateAdapter . createDate ( activeYear + yearsPerPage - 1 - activeYear % 24 , 0 , 1 ) ) ;
73
+ this . _dateAdapter . createDate ( activeYear + yearsPerPage - 1 - activeYear % 24 , 0 , 1 ) ) ;
75
74
return `${ firstYearInView } \u2013 ${ lastYearInView } ` ;
76
75
}
77
76
78
77
get periodButtonLabel ( ) : string {
79
78
return this . calendar . currentView == 'month' ?
80
- this . _intl . switchToMultiYearViewLabel : this . _intl . switchToMonthViewLabel ;
79
+ this . _intl . switchToMultiYearViewLabel : this . _intl . switchToMonthViewLabel ;
81
80
}
82
81
83
82
/** The label for the the previous button. */
@@ -106,19 +105,18 @@ export class MatCalendarHeader implements OnDestroy {
106
105
/** Handles user clicks on the previous button. */
107
106
previousClicked ( ) : void {
108
107
this . calendar . activeDate = this . calendar . currentView == 'month' ?
109
- this . _dateAdapter . addCalendarMonths ( this . calendar . activeDate , - 1 ) :
108
+ this . _dateAdapter . addCalendarMonths ( this . calendar . activeDate , - 1 ) :
110
109
this . _dateAdapter . addCalendarYears (
111
- this . calendar . activeDate ,
112
- this . calendar . currentView == 'year' ? - 1 : - yearsPerPage
110
+ this . calendar . activeDate , this . calendar . currentView == 'year' ? - 1 : - yearsPerPage
113
111
) ;
114
112
}
115
113
116
114
/** Handles user clicks on the next button. */
117
115
nextClicked ( ) : void {
118
116
this . calendar . activeDate = this . calendar . currentView == 'month' ?
119
- this . _dateAdapter . addCalendarMonths ( this . calendar . activeDate , 1 ) :
117
+ this . _dateAdapter . addCalendarMonths ( this . calendar . activeDate , 1 ) :
120
118
this . _dateAdapter . addCalendarYears (
121
- this . calendar . activeDate ,
119
+ this . calendar . activeDate ,
122
120
this . calendar . currentView == 'year' ? 1 : yearsPerPage
123
121
) ;
124
122
}
@@ -129,13 +127,13 @@ export class MatCalendarHeader implements OnDestroy {
129
127
return true ;
130
128
}
131
129
return ! this . calendar . minDate ||
132
- ! this . calendar . isSameView ( this . calendar . activeDate , this . calendar . minDate ) ;
130
+ ! this . calendar . isSameView ( this . calendar . activeDate , this . calendar . minDate ) ;
133
131
}
134
132
135
133
/** Whether the next period button is enabled. */
136
134
nextEnabled ( ) : boolean {
137
135
return ! this . calendar . maxDate ||
138
- ! this . calendar . isSameView ( this . calendar . activeDate , this . calendar . maxDate ) ;
136
+ ! this . calendar . isSameView ( this . calendar . activeDate , this . calendar . maxDate ) ;
139
137
}
140
138
141
139
ngOnDestroy ( ) {
0 commit comments