title: Javascript - Comparing dates without time
body: <p>I am trying to compare two dates in javascript without the time portions. The first date comes from a jquery datepicker and the second date comes from a string. </p>
  
  <p>Although I could swear that my method worked a while ago it looks like it is not working now.</p>
  
  <p>My browser is Firefox but I also need my code to work in IE.</p>
  
  <pre><code>function selectedDateRetentionDaysElapsed() {
      var dateSelectedDate = $.datepicker.parseDate('dd/mm/yy', $('#selectedDate').val());
      // dateSelectedDate is equal to date 2015-09-30T14:00:00.000Z
  
      var parsedRefDate = isoStringToDate('2015-11-10T00:00:00');
      var reportingDate = getPredfinedDateWithoutTime(parsedRefDate);
      // reportingDate is equal to date 2015-11-10T13:00:00.000Z
  
      var businessDayCountFromCurrentReportingDate = getBusinessDayCount(dateSelectedDate,reportingDate);
      // businessDayCountFromCurrentReportingDate is equal to 39.9583333333336
  
      if (businessDayCountFromCurrentReportingDate &gt;= 40) {
          return true;
      }       
      return false;
  }
  
  function isoStringToDate(dateStr) {
      var str = dateStr.split("T");
      var date = str[0].split("-");
      var time = str[1].split(":");
  
      //constructor is new Date(year, month[, day[, hour[, minutes[, seconds[, milliseconds]]]]]);
      return new Date(date[0], date[1]-1, date[2], time[0], time[1], time[2], 0);
  }
  
  function getPredfinedDateWithoutTime(myDate) {
      myDate.setHours(0,0,0,0)
      return myDate;
  }
  </code></pre>
  
  <p>My issues are...</p>
  
  <ol>
  <li>My isoStringToDate function is returning a date with a time even though I am not specifying a time.</li>
  <li>The setHours call on a date does not seem to be working either.</li>
  </ol>
  
  <p>Can someone please help me with this.</p>