@pmun/utils / endOf
Function: endOf()
ts
function endOf(date, unit): Date;
获取日期的结束时间
Parameters
date
日期
unit
OpUnitType
单位,可以是 'year', 'month', 'week', 'day', 'hour', 'minute', 'second'
Returns
Date
单位结束时间的日期对象
Example
ts
endOf(new Date('2023-05-15 15:30:45'), 'day') // Date 对象: Mon May 15 2023 23:59:59.999
endOf('2023-05-15 15:30:45', 'month') // Date 对象: Wed May 31 2023 23:59:59.999
endOf('2023-05-15 15:30:45', 'hour') // Date 对象: Mon May 15 2023 15:59:59.999