Updates the labels for the various sections of the header.
()
| 154 | |
| 155 | /** Updates the labels for the various sections of the header. */ |
| 156 | private _updateLabels() { |
| 157 | const calendar = this.calendar; |
| 158 | const intl = this._intl; |
| 159 | const adapter = this._dateAdapter; |
| 160 | |
| 161 | if (calendar.currentView === 'month') { |
| 162 | this._periodButtonText = adapter |
| 163 | .format(calendar.activeDate, this._dateFormats.display.monthYearLabel) |
| 164 | .toLocaleUpperCase(); |
| 165 | this._periodButtonDescription = adapter |
| 166 | .format(calendar.activeDate, this._dateFormats.display.monthYearLabel) |
| 167 | .toLocaleUpperCase(); |
| 168 | this._periodButtonLabel = intl.switchToMultiYearViewLabel; |
| 169 | this._prevButtonLabel = intl.prevMonthLabel; |
| 170 | this._nextButtonLabel = intl.nextMonthLabel; |
| 171 | } else if (calendar.currentView === 'year') { |
| 172 | this._periodButtonText = adapter.getYearName(calendar.activeDate); |
| 173 | this._periodButtonDescription = adapter.getYearName(calendar.activeDate); |
| 174 | this._periodButtonLabel = intl.switchToMonthViewLabel; |
| 175 | this._prevButtonLabel = intl.prevYearLabel; |
| 176 | this._nextButtonLabel = intl.nextYearLabel; |
| 177 | } else { |
| 178 | this._periodButtonText = intl.formatYearRange(...this._formatMinAndMaxYearLabels()); |
| 179 | // Format a label for the window of years displayed in the multi-year calendar view. Use |
| 180 | // `formatYearRangeLabel` because it is TTS friendly. |
| 181 | this._periodButtonDescription = intl.formatYearRangeLabel( |
| 182 | ...this._formatMinAndMaxYearLabels(), |
| 183 | ); |
| 184 | this._periodButtonLabel = intl.switchToMonthViewLabel; |
| 185 | this._prevButtonLabel = intl.prevMultiYearLabel; |
| 186 | this._nextButtonLabel = intl.nextMultiYearLabel; |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | /** Whether the two dates represent the same view in the current view mode (month or year). */ |
| 191 | private _isSameView(date1: D, date2: D): boolean { |
no test coverage detected