0

I'm trying to disable my datepicker using boolean condition but all my attempts don't work. If I enter startDate: new Date() in 'month-picker' It works as it should work.

$('.month-picker').datepicker({
    autoclose: true,
    format: "dd.mm.yyyy",
    startView: "year",
    minViewMode: "months"
   // startDate: new Date();
});
    
let initDate = function () {

    let anyYearAllowed = true;

    let iptDateFrom = $("#iptDateFrom").datepicker("setDate", new Date());

    if (anyYearAllowed) {

      // disable next dates

    } else {
      
       // disable previous dates
    }
};
 <input type="text" id="iptDateFrom" class="form-control month-picker"
 value="${.now?datetime?string('dd.mm.yyyy')}" style="width: 34%" required/>
cursorrux
  • 1,382
  • 4
  • 9
  • 20
  • No, I need disable previous or next dates in datepicker using condition but datepicker must stay enable – Nurdin Alymbaev Dec 22 '20 at 10:45
  • Does this answer your question? [jQuery Date Picker - disable past dates](https://stackoverflow.com/questions/8356358/jquery-date-picker-disable-past-dates) – OfirD Dec 22 '20 at 12:45

0 Answers0