endOfMonth

Commons
stable

Returns a new Date set to the last calendar day of the month containing the given date (midnight, day 0 of next month trick). The input date is not mutated.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

date
required
Date
Any date within the target month. Only the year and month parts are used.

API

Return value

The value returned by this util.

A new Date at midnight on the last day of the same month as the input.

Usage

Examples

Ready-to-paste usage snippets.

Last day of the month

typescript