Multiple-Dates-Picker-for-jQuery-UI icon indicating copy to clipboard operation
Multiple-Dates-Picker-for-jQuery-UI copied to clipboard

how can i disable all dates except some dates from my list

Open ducdm87 opened this issue 6 years ago • 3 comments

ducdm87 avatar Mar 23 '18 09:03 ducdm87

+1

wrabit avatar Sep 24 '19 13:09 wrabit

+1

I'm writing a screen to allow supervisors to approve employees' requested vacation days. Would like to allow selection of only the requested days.

elaw01887 avatar Jul 21 '20 13:07 elaw01887

You can update the options and supply a new function for 'beforeShowDay'.

multiDatePicker.multiDatesPicker({
            beforeShowDay: disableAllDaysExcept,
        });
function disableAllDaysExcept(date){
    //Do some logic to see if the date matches those in your list, where you would return true. Otherwise return false.
}

The date variable is a standard javascript date object

function disableSpecificWeekDays(date) {
  var theday = date.getDate() + '/' +
      (date.getMonth() + 1) + '/' +date.getFullYear();
  console.log(theday);//31/12/1999
  var day = date.getDay();
    return [day != 0 && day != 6];
}

And if you just want to disable all dates you would return false always in your supplied function

bmcn99 avatar Feb 05 '21 18:02 bmcn99