areIntervalsOverlapping
检查两个时间间隔是否重叠。
javascript
import { areIntervalsOverlapping } from "date-fns";
// 示例时间间隔
const interval1 = { start: new Date(2024, 0, 1), end: new Date(2024, 0, 10) };
const interval2 = { start: new Date(2024, 0, 5), end: new Date(2024, 0, 15) };
// 检查时间间隔是否重叠
const overlapping = areIntervalsOverlapping(interval1, interval2);
console.log("时间间隔是否重叠:", overlapping); // 时间间隔是否重叠:true