title: date difference greater than 90 days with JavaScript not working
body: <p>The below script is failing for the scenario : start date 09/12/2009 end date 10/15/2009. The date difference is not more than 90 days, but still fails. can any one help?</p>
  
  <pre><code>var startDate = new Date(document.getElementById('ctl00$MainContent$FromYearTxt').value);
          var endDate = new Date(document.getElementById('ctl00$MainContent$ToYearTxt').value);
  
          var monthsDiff = endDate.getMonth() - startDate.getMonth();
          var durationLimit = 0;
          for (i = 1; i &lt;= monthsDiff; i++) {
              durationLimit += new Date(startDate.getFullYear(), startDate.getMonth() + i, 0).getDate();
          }
  
          var timeDiff = endDate.getTime() - startDate.getTime();
          var daysDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
  
          if (daysDiff &gt; durationLimit) {
              args.IsValid = false;
          } else {
              args.IsValid = true;
          }
  </code></pre>