title: How to set and update the datepicker in Javafx to a maximum of 2 months?
body: <pre class="lang-java prettyprint-override"><code>DepatureD.setDayCellFactory(datePicker -&gt; new DateCell(){
      public void updateItem(LocalDate date, boolean empty) {
          super.updateItem(date, empty);
          LocalDate today = LocalDate.now();
  
          setDisable(empty || date.compareTo(today) &gt; 0 );
      }
  });
  </code></pre>
  
  <p>This is the code that I used to prevent the selection of past dates in DatePicker. I'm trying to find out how to set the date the range to 2 months from the present date and update it as the days go by.</p>