startOf
startOf(
date: Date,
unit: 'year' | 'month' | 'week' | 'day',
): DateSource: date.ts:282
Gets the start of a time period
Parameters
date(Date) — Input dateunit("year" | "month" | "week" | "day") — Time unit
Returns
Date— Start of the period
Example
CODE
startOf(new Date('2024-03-15 14:30:00'), 'day')
// 2024-03-15 00:00:00
startOf(new Date('2024-03-15'), 'month')
// 2024-03-01 00:00:00