This is my js code for my datepicker:
Calendar.setup({
inputField : 'scheduled_ajax_update',
ifFormat : '%d-%m-%Y',
button : 'scheduled_ajax_update_trig',
align : 'Bl',
singleClick : true,
disableFunc: function(date) {
var now = new Date();
if(date.getFullYear() < now.getFullYear()) { return true; }
if(date.getFullYear() == now.getFullYear() && date.getMonth() < now.getMonth()) { return true; }
if(date.getMonth() == now.getMonth() && date.getDate() < now.getDate()) { return true; }
}
});
It disables of the past days. My weird issue is that I cannot select any values from the current month, if my selected day is in the past. See img:
In this case I cannot select 27 or 28 .
If I click on the next month and then I go back to my current month I can choose 27 or 28.
No error messages in the console. Do you know why is this happening :) ?
Thank you!
1 Answer 1
According to this post the currentDateEl is set null , so I adapted my disableFunc script, like:
disableFunc: function(date) {
var now = new Date();
this.currentDateEl = now.getDate();
if(date.getFullYear() < now.getFullYear()) { return true; }
if(date.getFullYear() == now.getFullYear() && date.getMonth() < now.getMonth()) { return true; }
if(date.getMonth() == now.getMonth() && date.getDate() < now.getDate()) { return true; }
}
Now I am able to select the days from my current month if my current day is in the past.