title: How to compare two dates in JavaScript
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/492994/compare-dates-with-javascript">Compare dates with JavaScript</a>  </p>
  </blockquote>
  
  
  
  <p>I have two dates, start date and end date. I am comparing them like this:</p>
  
  <pre><code>var fromDate = $("#fromDate").val();
  var throughDate = $("#throughDate").val();
  
  if (startdate &gt;= enddate) {
      alert('start date cannot be greater then end date')
  }
  </code></pre>
  
  <p>It gives the correct result... the only problem is when I compare the dates 01/01/2013 and 01/01/2014.</p>
  
  <p>How can I correctly compare dates in JavaScript?</p>