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

Function isSameMultiYearView

src/material/datepicker/multi-year-view.ts:404–418  ·  view source on GitHub ↗
(
  dateAdapter: DateAdapter<D>,
  date1: D,
  date2: D,
  minDate: D | null,
  maxDate: D | null,
)

Source from the content-addressed store, hash-verified

402}
403
404export function isSameMultiYearView<D>(
405 dateAdapter: DateAdapter<D>,
406 date1: D,
407 date2: D,
408 minDate: D | null,
409 maxDate: D | null,
410): boolean {
411 const year1 = dateAdapter.getYear(date1);
412 const year2 = dateAdapter.getYear(date2);
413 const startingYear = getStartingYear(dateAdapter, minDate, maxDate);
414 return (
415 Math.floor((year1 - startingYear) / yearsPerPage) ===
416 Math.floor((year2 - startingYear) / yearsPerPage)
417 );
418}
419
420/**
421 * When the multi-year view is first opened, the active year will be in view.

Callers 2

_isSameViewMethod · 0.90
activeDateMethod · 0.85

Calls 2

getStartingYearFunction · 0.85
getYearMethod · 0.45

Tested by

no test coverage detected