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/>