Sprawdź, czy nie nakładają się czasu JavaScript

const arr = [
   { start: '01:00', end: '04:00' },
   { start: '05:00', end: '08:00' },
   { start: '07:00', end: '11:00' },
   { start: '09:30', end: '18:00' },
];
const overlapping = (a, b) => {
   const getMinutes = s => {
      const p = s.split(':').map(Number);
      return p[0] * 60 + p[1];
   };
   return getMinutes(a.end) > getMinutes(b.start) && getMinutes(b.end) > getMinutes(a.start);
};
const isOverlapping = (arr) => {
   let i, j;
   for (i = 0; i < arr.length - 1; i++) {
       for (j = i + 1; j < arr.length; j++) {
         if (overlapping(arr[i], arr[j])) {
            return true;
         }
      };
   };
   return false;
};
console.log(isOverlapping(arr));
Tiny Coders