2

I'm wondering if there's a method or option in JQuery datepicker to disable days in the calendar, or even a way to perhaps disable days so that choosing a month is enough to set the date.

Can't seem to find anything that does the job @ http://api.jqueryui.com/datepicker/#option-navigationAsDateFormat

I have a non-paying client who requested this, so would rather keep on using the datepicker component rather than try and re-engineer an input (dual input asi t would be due to them needing MM/YY).

Any help with this could be considered my christmas and birthday gifts combined.

Cheers in advance!

BizNuge
  • 938
  • 1
  • 8
  • 20
  • What about using searhc? http://stackoverflow.com/search?q=datepicker+disable+day+[jquery] – iappwebdev Dec 19 '12 at 10:53
  • 2
    do you mean like in here:: http://stackoverflow.com/questions/2208480/jquery-ui-datepicker-to-show-month-year-only – Sudhir Bastakoti Dec 19 '12 at 10:59
  • @Sudhir. That looks pretty much exactly what I was looking for. Kept searching and getting results for removing specific dates, rather than ALL dates. Cheers! – BizNuge Dec 19 '12 at 11:30

2 Answers2

2

you can refer http://davidwalsh.name/jquery-datepicker-disable-days to do hope it can help you

0

You can use the beforeShowDate event of the datepicker combined with Date.getDay() to do what you want, like this:

​$("#datepicker").datepicker({
    beforeShowDay: function(date) {
        var day = date.getDay();
        return [(day != 1 && day != 2)];
    }
})​​​​​;​
palaѕн
  • 72,112
  • 17
  • 116
  • 136