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

Function getStartingYear

src/material/datepicker/multi-year-view.ts:439–452  ·  view source on GitHub ↗

* We pick a "starting" year such that either the maximum year would be at the end * or the minimum year would be at the beginning of a page.

(
  dateAdapter: DateAdapter<D>,
  minDate: D | null,
  maxDate: D | null,
)

Source from the content-addressed store, hash-verified

437 * or the minimum year would be at the beginning of a page.
438 */
439function getStartingYear<D>(
440 dateAdapter: DateAdapter<D>,
441 minDate: D | null,
442 maxDate: D | null,
443): number {
444 let startingYear = 0;
445 if (maxDate) {
446 const maxYear = dateAdapter.getYear(maxDate);
447 startingYear = maxYear - yearsPerPage + 1;
448 } else if (minDate) {
449 startingYear = dateAdapter.getYear(minDate);
450 }
451 return startingYear;
452}
453
454/** Gets remainder that is non-negative, even if first number is negative */
455function euclideanModulo(a: number, b: number): number {

Callers 2

isSameMultiYearViewFunction · 0.85
getActiveOffsetFunction · 0.85

Calls 1

getYearMethod · 0.45

Tested by

no test coverage detected