Question

I have the follow code to disable 22-02-2014, but don´t works...

beforeShowDay: function(date) {
            var day = date.getDay();
            return [(day == 0 || day == 6)];
            var array = ["22-02-14"]
            $('#input_2_5').datepicker({
beforeShowDay: function(date){
            var string = jQuery.datepicker.formatDate('dd-mm-yy', date);
            return [ array.indexOf(string) == -1 ]

Form with datepicker is here

Can anyone help me? Thanks!

Was it helpful?

Solution

The date format you're using dd-mm-yy equates to 22-02-2014 not 22-02-14 in jQuery. You could either change the declaration of the array to:

var array = ["22-02-2014"];

or change the format used in formatDate to:

var string = jQuery.datepicker.formatDate('dd-mm-y', date);

I'd suggest the first option as the second option would not allow 22-02-1914 to be selected.

A JSFiddle can be found here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top