title: How to determine if two date ranges overlap?
body: <p>I have the following dates in utc timestamps. I would like to know whether the two time ranges overlap. Here's the code that I have so far:</p>
  <pre><code>dateRangeOverlaps(aStart, aEnd, bStart, bEnd) {
     if (aStart &lt;= bStart &amp;&amp; bStart &lt;= aEnd) return true; // b starts in a
     if (aStart &lt;= bEnd   &amp;&amp; bEnd   &lt;= aEnd) return true; // b ends in a
     if (bStart &lt;  aStart &amp;&amp; aEnd   &lt;  bEnd) return true; // a in b
     return false;
  }
  </code></pre>
  <p>Unfortunately, when the start times or end times overlap, the function returns true. For example, if I have the times: 9 am to 11am and 11am to 1pm, these two times should not overlap, but the function returns true nonetheless.</p>
  <p>Or if I have the time 8am to 11am and 11am to 1pm, it returns true.</p>
  <p>How can I make it return false for the times above?</p>
  <p>so</p>
  <pre><code>// 11:00
  const aStart = 1641052800000;
  
  // 11:30
  const aEnd = 1641054600000;
  
  // 9:00
  const bStart = 1641045600000;
  
  // 11:00
  const bEnd = 1641052800000;
  
  // should return false       
  console.dir(dateRangeOverlaps(aStart, aEnd, bStart, bEnd))
  </code></pre>