isSameMonth

Commons
stable

Returns true when two Date objects fall in the same calendar month and year. Used in date pickers to determine which cells belong to the current month view.

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. Both month index and full year must match.

API

Return value

The value returned by this util.

true when the month index and year are identical for both dates; false when either differs.

Usage

Examples

Ready-to-paste usage snippets.

Comparing dates for same-month equality

typescript