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

Function compareDate

src/material/core/datetime/date-adapter.ts:294–300  ·  view source on GitHub ↗

* Compares two dates. * @param first The first date to compare. * @param second The second date to compare. * @returns 0 if the dates are equal, a number less than 0 if the first date is earlier, * a number greater than 0 if the first date is later.

(first: D, second: D)

Source from the content-addressed store, hash-verified

292 * a number greater than 0 if the first date is later.
293 */
294 compareDate(first: D, second: D): number {
295 return (
296 this.getYear(first) - this.getYear(second) ||
297 this.getMonth(first) - this.getMonth(second) ||
298 this.getDate(first) - this.getDate(second)
299 );
300 }
301
302 /**
303 * Compares the time values of two dates.

Callers

nothing calls this directly

Calls 3

getYearMethod · 0.45
getMonthMethod · 0.45
getDateMethod · 0.45

Tested by

no test coverage detected