JQuery user interface: select date pick date on datepicker

I want to filter the selected dates on a datepicker. Basically, I have to filter by weekdays - i.e. Make weekends and weekends inaccessible.

I know that you can specify dates using a function in beforeShowDate: and you can also use $ .datepicker.noWeekends.

Question: can you do both?

+3
source share
3 answers

$. datepicker.noWeekends is a pretty simple bit of code:

function (date) { 
    var day = date.getDay(); 
    return [day > 0 && day < 6, ""]; 
}

Since you will need to write a function for the holidays, you can simply include this logic in this function.

+6
source

Can you do the opposite and indicate which dates you can choose and leave everything else filtered?

0

, .

. , , - :

onlyMondays: function(date){
    var day = date.getDay();
    return [(day == 1), ""]
}
0

Source: https://habr.com/ru/post/1698767/


All Articles