0

I have a date picker on my page that I am trying to disable all days except Sunday when a value is selected in a Kendo Drop Down. My function is below. The function is called but I am not sure how to or if I can set the disabled dates this way. Can anyone point me in the right direction of syntax to do this?

I have tried

function dropdownChanged() {

    var startdate = $("#startdate").data("kendoDatePicker");

    //tried this with no luck
    var start_disabled = ["mo", "tu", "we", "th", "fr", "sa"];
    startdate.disableDates(start_disabled);

}

Thanks!

user2675736
  • 73
  • 2
  • 8

1 Answers1

1

See the documentation here.

<input id="datepicker" />
<script>
$("#datepicker").kendoDatePicker({
    value: new Date(),
    disableDates: function (date) {
        var disabled = [13,14,20,21];
        if (date && disabled.indexOf(date.getDate()) > -1 ) {
            return true;
        } else {
            return false;
        }
    }
});
</script>


<input id="datepicker" />
<script>
$("#datepicker").kendoDatePicker({
    value: new Date(),
    disableDates: ["we", "th"],
});
</script>
Ross Bush
  • 14,648
  • 2
  • 32
  • 55
  • Not sure how I didn't get that before. I did see it in the documentation but I was thinking that I could just set a property similar to .value. Thanks for the quick reply! worked like a charm! – user2675736 Jul 08 '16 at 17:44