Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable all Sundays in jQuery UI Calendar

Tags:

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.

like image 910
Mohit Jain Avatar asked Dec 07 '10 13:12

Mohit Jain


People also ask

How do I turn off Sundays in Datepicker?

To disable the weekends in Bootstrap Datepicker you need to set the daysOfWeekDisabled property value to [0, 6]. Then all the Weekends will be disabled in the datepicker control. Check this example.

How to disable weekends in jQuery datepicker?

To disable the weekends in jQuery UI Datepicker you need to set the beforeShowDay property value to $. datepicker. noWeekends. Then all the Weekends will be disabled in the date picker control.


1 Answers

try this

$("#datepicker").datepicker({     beforeShowDay: function(date) {         var day = date.getDay();         return [(day != 0), ''];     } }); 
like image 116
Bhanu Prakash Pandey Avatar answered Sep 21 '22 15:09

Bhanu Prakash Pandey