Function: endOf()
ts
function endOf(date, unit): Date;Set the end of a calendar unit (local time). Week ends on Sunday 23:59:59.999. 将日期对齐到某个日历单位的结束(本地时间)。一周结束于周日 23:59:59.999。
Parameters
| Parameter | Type |
|---|---|
date | Date |
unit | StartEndUnit |
Returns
Date
Example
ts
endOf(new Date('2026-05-08T10:00:00'), 'month') // 2026-05-31 23:59:59.999Since
1.0.0