MCPcopy Create free account
hub / github.com/angular/components / _updateActiveDate

Method _updateActiveDate

src/material/datepicker/year-view.ts:203–212  ·  view source on GitHub ↗

* Takes the index of a calendar body cell wrapped in an event as argument. For the date that * corresponds to the given cell, set `activeDate` to that date and fire `activeDateChange` with * that date. * * This function is used to match each component's model of the active date with the

(event: MatCalendarUserEvent<number>)

Source from the content-addressed store, hash-verified

201 * updated value asynchronously via the `activeCell` Input.
202 */
203 _updateActiveDate(event: MatCalendarUserEvent<number>) {
204 const month = event.value;
205 const oldActiveDate = this._activeDate;
206
207 this.activeDate = this._getDateFromMonth(month);
208
209 if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
210 this.activeDateChange.emit(this.activeDate);
211 }
212 }
213
214 /** Handles keydown events on the calendar body when calendar is in year view. */
215 _handleCalendarBodyKeydown(event: KeyboardEvent): void {

Callers

nothing calls this directly

Calls 2

_getDateFromMonthMethod · 0.95
compareDateMethod · 0.80

Tested by

no test coverage detected