0

I am using a kendo datepicker where I want to disable all the wednesdays. The hacky way of doing this is to create an array of all wednesdays and then pass that list to Kendo.

There has to be a better way, either natively via kendo or a javascript function that generates all wednesdays for the current year and returns a list of the dates.

I am struggling with both approaches. Will appreciate any pointers in this. TIA

w2olves
  • 2,229
  • 10
  • 33
  • 60
  • Take a look at the [`disableDates`](http://docs.telerik.com/kendo-ui/api/javascript/ui/datepicker#configuration-disableDates) option. – rgajrawala Apr 10 '17 at 18:52

1 Answers1

2

Use disableDates: function (date) option and for disabling wednesdays simply return if day of week is 4 (days are zero based)

disableDates: function (date){
  return date.getDay() === 4;
}  

Or as noted in comments can use array of short day names

disableDates: ["we", "th"] // no wed or thurs
charlietfl
  • 170,828
  • 13
  • 121
  • 150