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

Method _isSameView

src/material/datepicker/calendar.ts:191–209  ·  view source on GitHub ↗

Whether the two dates represent the same view in the current view mode (month or year).

(date1: D, date2: D)

Source from the content-addressed store, hash-verified

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 {
192 if (this.calendar.currentView == 'month') {
193 return (
194 this._dateAdapter.getYear(date1) == this._dateAdapter.getYear(date2) &&
195 this._dateAdapter.getMonth(date1) == this._dateAdapter.getMonth(date2)
196 );
197 }
198 if (this.calendar.currentView == 'year') {
199 return this._dateAdapter.getYear(date1) == this._dateAdapter.getYear(date2);
200 }
201 // Otherwise we are in 'multi-year' view.
202 return isSameMultiYearView(
203 this._dateAdapter,
204 date1,
205 date2,
206 this.calendar.minDate,
207 this.calendar.maxDate,
208 );
209 }
210
211 /**
212 * Format two individual labels for the minimum year and maximum year available in the multi-year

Callers 2

previousEnabledMethod · 0.95
nextEnabledMethod · 0.95

Calls 3

isSameMultiYearViewFunction · 0.90
getYearMethod · 0.45
getMonthMethod · 0.45

Tested by

no test coverage detected