title: compare intersection of two datetime interval in javascript
body: <p>I have two date time interval :</p>
  
  <pre><code>first stardate : 2014-06-20#00:01
  first enddate  : 2014-06-24#23:59
  
  second startdate : 2014-06-25#00:01
  second enddate   : 2014-06-27#23:59
  </code></pre>
  
  <p>I can compare startdate &lt; enddate with parsing to int 201406200001 &lt; 201406242359</p>
  
  <p>But I want to compare intersection of first date interval and second date interval.</p>
  
  <p>First interval can be > or &lt; second interval but these two intervals should not have any intersection.</p>
  
  <p>How can I write this algorithm  in javascript ?</p>