user2675736
user2675736

Reputation: 73

Kendo DatePicker Disable Dates jQuery

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!

Upvotes: 0

Views: 3685

Answers (1)

Ross Bush
Ross Bush

Reputation: 15155

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>

Upvotes: 1

Related Questions