code: public void setMaxDate(@Nullable Calendar maxDate) {
          this.maxDate = maxDate;
          // update the date picker (even if it is not used right now)
          if(maxDate == null)
              datePickerDialog.setMaxDate(null);
          else if(minDate != null && compareCalendarDates(minDate, maxDate) > 0)
              throw new IllegalArgumentException("Maximum date must be after minimum date!");
          else
              datePickerDialog.setMaxDate(new CalendarDay(maxDate));
          updateEnabledItems();
      }
docs: Sets the maximum allowed date.
  Spinner items and dates in the date picker after the given date will get disabled.
  @param maxDate The maximum date, or null to clear the previous max date.