isSameYear

Commons
stable

Returns true when two Date objects fall in the same calendar year. Used in year pickers and date range validation.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

date
required
Date
The first date to compare.
comparing
required
Date
The second date to compare against. Only the full year (getFullYear()) is compared.

API

Return value

The value returned by this util.

true when both dates have the same full year; false otherwise.

Usage

Examples

Ready-to-paste usage snippets.

Comparing dates for same-year equality

typescript