endOf
endOf(date: Date, unit: 'year' | 'month' | 'week' | 'day'): DateSource: date.ts:324
Gets the end of a time period
Parameters
date(Date) — Input dateunit("year" | "month" | "week" | "day") — Time unit
Returns
Date— End of the period
Example
CODE
endOf(new Date('2024-03-15'), 'day')
// 2024-03-15 23:59:59.999
endOf(new Date('2024-03-15'), 'month')
// 2024-03-31 23:59:59.999