title: How do I get the difference days between two Dates in JavaScript?
body: <pre><code>&lt;input type="date" id="startDate" /&gt;
  &lt;input type="date" id="endDate" /&gt;
  
  &lt;script&gt;
     $("#endDate").click(function () {
          var date1 = $("#startDate").val();
          var date2 = $("#endDate").val();
          var timeDiff = Math.abs(date2.getTime() - date1.getTime());
          var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)); 
          alert(diffDays)​;
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>getTime not work , and this message shown 
  intellisense was unable to determine an accurate completion list for this expression
  How do I get the difference days between two Dates in this case and how can getTime work with me ?</p>