📜  日期重叠的周期比较数组 - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:58.848000             🧑  作者: Mango

代码示例1
checkDateTimeOverlap = (dateTimes)=>{
        let isOverlap = false;
        dateTimes.forEach((time,i) => {
            let  st1 = time[0];
            let  et1 = time[1];
          
            dateTimes.forEach((time2,j) => {               
                if(i != j){
                    let st2 = time2[0];
                    let et2 = time2[1];
                    if (st1 >= st2 && st1 <= et2 || et1 >= st2 && et1 <= et2 || st2 >= st1 && st2 <= et1 || et2 >= st1 && et2 <= et1) {
                        isOverlap =  true;
                    }else{
                        isOverlap =  false;
                    }
                }
            })
        }); 

        return isOverlap;
    }