Skip to content

Function: isSameWeek() ​

ts
function isSameWeek(date1, date2): boolean;

Same ISO week (Monday–Sunday) in local time. 本地时间是否为同一个 ISO 周(周一至周日)。

Parameters ​

ParameterType
date1Date
date2Date

Returns ​

boolean

Example ​

ts
isSameWeek(new Date(2026, 4, 4), new Date(2026, 4, 10)) // => true (Mon–Sun of same week)

Since ​

1.0.0

Released under the MIT License.