isSameDay

Commons
stable

Returns true when two Date objects fall on the same calendar day (same date, month, and year in local timezone). Used in date pickers and calendar views to highlight selected or today cells.

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. Day, month, and full year must all match for the function to return true.

API

Return value

The value returned by this util.

true when date and comparing share the same local calendar day; false when any of day, month, or year differ.

Usage

Examples

Ready-to-paste usage snippets.

Comparing two dates for same-day equality

typescript