I am using a function to disable all days excepts mondays or enable the next working day to the holiday monday. I run the function before show the calendar and it works perfectly but I need to run the function again when the user change the current month in the calendar.
This is the calendar:
<p:calendar beforeShowDay="disableDays" navigator="true" readonlyInput="true" showOn="button" value="#{bean.date}">
<f:convertDateTime pattern="yyyy/MM/dd" timeZone="#{timeZone}" />
</p:calendar>
And the function:
function disableDays(date) {
var datesToDisable = [ "8-1-2015", "8-2-2015", "8-4-2015", "8-5-2015", "8-6-2015", "8-7-2015", "8-8-2015", "8-9-2015", "8-11-2015", "8-12-2015", "8-13-2015", "8-14-2015", "8-15-2015", "8-16-2015", "8-17-2015", "8-19-2015", "8-20-2015", "8-21-2015", "8-22-2015", "8-23-2015", "8-25-2015", "8-26-2015", "8-27-2015", "8-28-2015", "8-29-2015", "8-30-2015" ];
var month = date.getMonth(), day = date.getDate(), annio = date.getFullYear();
for (i = 0; i < datesToDisable.length; i++) {
if ($.inArray((month + 1) + '-' + day + '-' + annio, datesToDisable) != -1) {
return [ false ];
}
}
return [ true ];
}
How can I do that?