You can use the isSameISOWeekYear function from date-fns to check if two dates are in the same ISO week year. Here is an example:
index.tsx273 chars11 lines
In this example, the isSameISOWeekYear function is used to check if date1 and date2 are in the same ISO week year. Since they both fall within the ISO week year 2020, the function returns true. On the other hand, date1 and date3 fall in different ISO week years (2021 and 2022, respectively), so the function returns false.
gistlibby LogSnag