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

Method _updateActiveDate

src/material/datepicker/month-view.ts:289–297  ·  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

287 * updated value asynchronously via the `activeCell` Input.
288 */
289 _updateActiveDate(event: MatCalendarUserEvent<number>) {
290 const month = event.value;
291 const oldActiveDate = this._activeDate;
292 this.activeDate = this._getDateFromDayOfMonth(month);
293
294 if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
295 this.activeDateChange.emit(this._activeDate);
296 }
297 }
298
299 /** Handles keydown events on the calendar body when calendar is in month view. */
300 _handleCalendarBodyKeydown(event: KeyboardEvent): void {

Callers

nothing calls this directly

Calls 2

compareDateMethod · 0.80

Tested by

no test coverage detected