<script> const range = [ { st: "2022-11-29 10:00", et: "2022-11-29 11:00", }, { st: "2022-11-29 15:00", et: "2022-11-29 19:00", }, ]; const startTime = new Date("2022-11-29 16:00").getTime(); const endTime = new Date("2022-11-29 17:00").getTime(); let flag = true; for (let index in range) { const st = new Date(range[index]["st"]).getTime(); const et = new Date(range[index]["et"]).getTime(); if (endTime <= st || startTime >= et) { } else { flag = false; break; } } if (flag == false) alert("时间区间重叠"); </script>
标签:11,00,const,重叠,29,js,2022,区间,et From: https://www.cnblogs.com/caroline2016/p/16944848.html