jQuery datepicker Disabled Weekday

There is another custom setting for jQuery datapicker. Here we have discuss about how to disabled any weekday in jQuery datepicker. As you know in today’s era jQuery become more and more popular and why not? It should be because jQuery does our work very easy. Recently, in our one of the project need to give date field value in one of the form. In this form date calculate dynamic with exclude weekend days (Saturday and Sunday) as per client timeline setting but client also wants their employee also change date value manually. Now what, we need to give datepicker to the text field and as we love jQuery so of course we use jQuery datepicker and see there is no default function to handle disabled weekday. We know there is a function to handle custom setting before show datapicker and before show day. i.e. there are two different function beforeShow, beforeShowDay. beforeShow function uses when you want to set before showing datepicker and beforeShowDay function uses when you want to apply setting before load each day. So we use beforeShowDay function to disabled day. It’s very simple and short code for disabling weekday. Let’s understand by example.

beforeShowDay : function(date){
if(date.getDay()== 0 || date.getDay()== 6)
return [0];
return [1];


beforeShowDay function returns date value so we just get DAY from date and give condition for that if Sunday or Saturday then return 0 or 1 but keep in mind it allows return format in array.