jQuery datepicker, how to disable one day?

Today I needed to disable one day in the jQuery ui datepicker. I did some research, and I found out, it is actually much simpler than I thought. There is something available in the plugin itself ($.datepicker.noWeekends).

The actual code I needed is like this:

$('.js--trigger-datepicker').datepicker({
        beforeShowDay: function( date ) {
 var ignoreDay = 0; // sunday === 0, monday === 1, etc
return [(date.getDay() != ignoreDay), ''];  }  });

Enjoy! (I do at least ;-))

Speak Your Mind

*