If you want to use VERY FLEXIBLE and deactivate any date you want for a certain period of time, you can do the following:
$ dt_str are the dates you want to disable. You can structure it using PHP, for example, and get your dates from the database.
When the DOM boots, disableDates () is called and the magic happens.
var avDays = <?php echo $dt_str ?>; <script type='text/javascript'> $(document).ready( function(){ // Datepicker $('.datepicker_event').datepicker( { inline: true, numberOfMonths: 2, beforeShowDay: disableDates }); } ) function disableDates(date) { var isAvailable = false ; // Find the days to deactivate if (avDays != null) { for (i = 0; i < avDays.length; i++) { if (date.getMonth() == avDays[i][0] - 1 && date.getDate() == avDays[i][1] && date.getFullYear() == avDays[i][2]) { isAvailable = true; } } } if (isAvailable) return [true, 'av_day'] ; else return [false, '']; } </script>
Quentin
source share