title: How to validate/compare start time and end time in Javascript?
body: <pre><code>let d0 = new Date('07/08/2021'+'10:00 AM') // already booked start date. 
  let d1 = new Date('07/08/2021'+'10:00 PM') // already booked end date.
  let d2 = new Date('07/08/2021'+'06:00 AM') // new user start date.
  let d3 = new Date('07/08/2021'+'10:00 AM') // new user end date.
  
  if ((d2 &lt; d0 &amp;&amp; d3 &lt;= d0) || (d2 &lt; d1 &amp;&amp; d3 &lt;= d1)) {
    return true;
  }
  </code></pre>
  <p>*this condition is only working for in-between times. Suppose, one user enters 6AM-10AM(or)6AM-11PM. It didn't work.</p>