Search code examples
jqueryjquery-uijquery-pluginsdatepicker

Disable all Sundays in jQuery UI Calendar


I want to disable Sundays in jQuery UI calendar.

From docs I came to know about this:--

$('#datepicker').datepicker({ minDate: 4,beforeShowDay: $.datepicker.noWeekends }); 

This will disable Saturdays and Sundays both. But I want to diasble only Sunday. Is there any default option for this.

Bad way to solve it

beforeShowDay take true or false as params for every day. So write a function which returns true or false based upon each day.


Solution

  • try this

    $("#datepicker").datepicker({
        beforeShowDay: function(date) {
            var day = date.getDay();
            return [(day != 0), ''];
        }
    });