code: function isDateWithinRange(date, minDate, maxDate) {
         var dateAtMidnight = createDateAtMidnight(date);
         var minDateAtMidnight = isValidDate(minDate) ? createDateAtMidnight(minDate) : null;
         var maxDateAtMidnight = isValidDate(maxDate) ? createDateAtMidnight(maxDate) : null;
         return (!minDateAtMidnight || minDateAtMidnight <= dateAtMidnight) &&
             (!maxDateAtMidnight || maxDateAtMidnight >= dateAtMidnight);
       }
docs: Checks if a date is within a min and max range, ignoring the time component.
  If minDate or maxDate are not dates, they are ignored.
  @param {Date} date
  @param {Date} minDate
  @param {Date} maxDate