js判断多个时间段是否有重叠部分
for (let i = 0; i < times.length; i++) {
for (let j = 0; j < times.length; j++) {
if (i == j) {
continue
} else {
let is = parseInt(times[i].starttime.replace(":", ""));
let ie = parseInt(times[i].endtime.replace(":", ""));
let js = parseInt(times[j].starttime.replace(":", ""));
let je = parseInt(times[j].endtime.replace(":", ""));
if ((is <= je && is >= js) || (ie >= js && ie <= je) || (is <= js && ie >= je) || (is >= js && ie <=
je)) {
callback(times[i].starttime + '~' + times[i].endtime + '和' + times[j].starttime + '~' + times[j]
.endtime + '时间段有重叠')
return;
}
}
}
}