[Datepicker] Disable all days except Saturday in datepicker

[Datepicker] Disable all days except Saturday in datepicker

  
Forge Component
(14)
Published on 2014-11-17 by Hugo Pinheiro
14 votes
Published on 2014-11-17 by Hugo Pinheiro

How we can disable all days except Saturday in datepicker including apply min/max date range.

Hi Dear Arvind!

You have to customize the JS and create a logic to verify the weekday and if wasn't be saturday set the css class: "ui-datepicker-disabled", "ui-datepicker-unselectable" 

Solution

Hi Leandro,

I have discovered  solution of my question myself. I added few lines of code to accomplish the problem. 

1. Need to pass input parameter as below, to disable any days from datepicker calendar.

2. Need to add selected below line of code in JavaScript.

var DISALLOW_DAYS = [" + DaysToDisallow + "];

3. Add selected line of code in else condition as below.

beforeShowDay: function(date) {
                // date is a JS Date object
                return  [$.inArray(date.getDay(), DISALLOW_DAYS) == -1 ]
            },

Hope this will help to other.

Solution