开发者

How can I pick from two ranges of dates with datepicker in jQuery?

I am using the jQuery Datepicker(http://keith-wood.name/datepick.html). I am trying to let the user pick a date from two separate ranges of days. I can't find that feature in the documentation and I would like to know how to make that possible.

I want to l开发者_Python百科et the user pick from 1-5 days after the current date. I also don't want to allow the user to pick days on the weekend. I figured out how to do that using the following settings:

$("#rush_needed_by_english").datepick({
  minDate: +1,
  maxDate: +5,
  beforeShowDay: $.datepick.noWeekends
});

As it is now, if the current day is a Thursday for example, it will only allow the user to pick Friday,Monday, and Tuesday since it is set up to only allow 1-5 days after the current day to be selectable, but Saturday and Sunday are not selectable.

As far as my example is concerned, what I would like is to either skip the weekend days completely and make Friday and Monday-Thursday selectable. Or if that is not possible, I would like to set the two different ranges of days to pick from. So per my example, I would use javaScript to find the current day(Thursday), and then make two selectable ranges of dates(Friday AND Monday-Thursday).

How can I skip the weekend days so 5 days are selectable while skipping over the weekend days?


I figured out I can just extend the MaxDate by a certain number of days to simulate skipping over the weekend days. Mission Solved!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜