longbill/jquery-date-range-picker

Using buttons to disable days

RussellJonesPersonal opened this issue · 4 comments

Hi

I can't figure out how to (or if it's possible to) disable days using an external button or check-boxes?

I need my users to be able to disable any day by clicking Mon - Sun check-boxes (buttons would do fine) placed above the calendar.

Is this possible? Could you advise? Thanks in advance!

Russ

Hi, please see the beforeShowDay property. This option receives a function that has a date as argument and should return whether the date is selectable or not. It's example 26 from the docs (https://longbill.github.io/jquery-date-range-picker/).

Thanks for the advice, but this doesn't appear to do what I need it to do. As far as I can tell (forgive me if I'm mistaken) this disables specified dates / days when the calendar is initiated. But it doesn't appear to work if I want to use a button to disable/enable days after init. Am I wrong? Thanks.

Actually no, that function is executed every time the dropdown is opened, not only when initialized. Please see this JSFiddle.

Thanks for confirming! I'll have to write something to do this - it's important that the calendar is always open. I appreciate your responses.