code: function clampDate(date, minDate, maxDate) {
         var boundDate = date;
         if (minDate && date < minDate) {
           boundDate = new Date(minDate.getTime());
         }
         if (maxDate && date > maxDate) {
           boundDate = new Date(maxDate.getTime());
         }
         return boundDate;
       }
docs: Clamps a date between a minimum and a maximum date.
  @param {Date} date Date to be clamped
  @param {Date=} minDate Minimum date
  @param {Date=} maxDate Maximum date
  @return {Date}