startOfMonth

Commons
stable

Return a new Date set to the first day of the same month (day 1, time 00:00:00). The original 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. Year and month are preserved; day is forced to 1 and time fields are cleared.

API

Return value

The value returned by this util.

A new Date at the first day of the month, time 00:00:00.

Usage

Examples

Ready-to-paste usage snippets.

Get the first day of the current month

typescript