2

I have an array in javascript like this:

enter image description here

I tried to disable these dates using datepicker beforeShowday config like this:

                     beforeShowDay: function(date) {
                      var string = jQuery.datepicker.formatDate('dd/mm/yy', calendar.holidays);
                      return [ array.indexOf(string) == -1 ]
                    }

but the dates that i want to disable keeps appearing

1 Answer 1

1

the doc:

The function is called for each day in the datepicker before it is displayed.

So our code should: for the date passed in, which will be every date that's to be displayed, jQuery.datepicker.formatDate it, and check whether the resulting string is one of the holidays.

Something like:

beforeShowDay: function(date) {
    var string = jQuery.datepicker.formatDate('mm/dd/yy', date);
    return [ calendar.holidays.indexOf(string) == -1 ]
}
Sign up to request clarification or add additional context in comments.

1 Comment

thanks, i tried to change it, but i got the following error : Uncaught TypeError: Unable to process binding "datepicker: function(){return true }" Message: date.getMonth is not a function

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.