title: JavaScript NaN Error in IE but not in Firefox, Chrome etc
body: <p>I've got a page where two dates are selected and the inclusive difference between them is displayed in a third text input.</p>
  
  <p>The calculation is made nicely in Firefox, Chrome etc but IE6, IE7 &amp; IE8 a NaN error is displayed.</p>
  
  <p>I've tried parseInt(), number() etc but to no avail.</p>
  
  <p>It's all being temporarily held at <a href="http://www.thewebdes.co.uk/dev/hol/" rel="nofollow">http://www.thewebdes.co.uk/dev/hol/</a> and there's a .rar file so all code is downloadable if you wish to help. I'm hoping it's a simple one to people who are good with JavaScript!</p>
  
  <p>--- edit ---</p>
  
  <p>Sorry guys,</p>
  
  <pre><code>$('#firstday, #lastday').datepicker({
      showOn: 'both',
      buttonImage: 'img/cal.gif',
      dateFormat: 'dd/mm/yy',
      onSelect: function(){
        // Date will give time difference in miliseconds, divide with 1000*60*60*24
        var firstday = new Date($("#firstday").val().split("/").reverse().join(","));
        var lastday = new Date($("#lastday").val().split("/").reverse().join(","));
        // Remove weekend days from count
        var weekend_count = 0;
        for (i = firstday.valueOf(); i &lt;= lastday.valueOf(); i+= 86400000) {
          var temp = new Date(i);
          if (temp.getDay() == 0 || temp.getDay() == 6) {
            weekend_count++;
          }
        }
        var totaldays = ((lastday - firstday) / 86400000) + 1 - weekend_count;
        $('#totaldays').val(parseInt(totaldays)); // parseInt as sometimes, with a long gap between first and last, a decimal number is displayed. Ok, people wont be booking 120 day holidays, but it keeps things proper
      }
    });
  </code></pre>