仅在接下来的5个工作日内允许jquery datepicker

问题描述:

我有一个日期选择器,用于设置约会.唯一的问题是老板希望约会日期最多为接下来的5个工作日.我知道如何禁用周末,但是我不清楚如何做到这一点,因此,如果我选择一个星期三,它可以让我选择一个到下一个星期三的日期,并且还要考虑到周末.有人对如何实现这一目标有任何想法吗?

I have a datepicker which I am using to set appointments. The only problem with this is that the boss wants the appointment date to only be up to the next 5 business days. I know how to disable the weekends, but I am a little unclear as to how I can make it so that if I choose a wednesday, it lets me select a date up to the next wednesday and accounts for the weekends as well. Any one have any ideas on how to accomplish this?

我认为这就是您想要的

$('yourSelector').datepicker({
    minDate: 0, // your min date
    maxDate: '+1w', // one week will always be 5 business day - not sure if you are including current day
    beforeShowDay: $.datepicker.noWeekends // disable weekends
});

http://jsfiddle.net/wANFJ/