Skip to content

@pmun/utils / getThisHalfYearRange

Function: getThisHalfYearRange()

ts
function getThisHalfYearRange(): DateRange;

获取本半年的开始和结束时间戳

Returns

DateRange

日期范围元组 [开始时间戳, 结束时间戳]

Example

ts
const [start, end] = getThisHalfYearRange()
// 如果当前是5月(上半年),则:
// start: 1月1日 00:00:00 的时间戳
// end: 6月30日 23:59:59.999 的时间戳