nazar-pc / PickMeUp

Really simple, powerful, customizable and lightweight standalone datepicker
BSD Zero Clause License
616 stars 189 forks source link

Disable all weekends #100

Closed cristhian-net closed 8 years ago

cristhian-net commented 8 years ago

I want to disable all weekends on all my calendars (12 months displayed), so my employee's vacations only count business days . Is this possible ? Thanks in advance!

nazar-pc commented 8 years ago

Yes, you can use render event for this:

...
    render : function (date) {
        if (date.getDay() == 0 || date.getDay() == 6) {
            return {disabled : true};
        }
        return {};
    }
...

But this will only make them impossible to select, if you take date range - you'll need to remove weekends from total number of days in range manually.

cristhian-net commented 8 years ago

I've already done this, thanks. And total number of days are total range selected days including weekends like you said, but doesn't matter. Cheers!