endOfDay

Commons
stable

Returns a new Date set to the last millisecond of the given day (23:59:59.999 local time). 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
The reference date. Only the year/month/day part is used; the time is replaced with 23:59:59.999.

API

Return value

The value returned by this util.

A new Date at 23:59:59.999 on the same calendar day as the input.

Usage

Examples

Ready-to-paste usage snippets.

Get the last moment of a day

typescript