禁用当前的+未来 3 个工作日

发布于 2024-12-17 03:51:23 字数 466 浏览 5 评论 0原文

可能的重复:
jQuery UI 可以吗日期选择器可以禁用周六和周日(以及节假日)吗?

我正在使用 jQuery Datepicker。

我想要做的是选择今天或明天的交货日期 -

1) 应该空白接下来的 3 个工作日,即如果我星期一订购,我最早选择的交货日期是星期五。

2) 禁用 2011 年 12 月 20 日至 27 日作为选项

3) 必须禁用周末

4) 必须禁用所有英国假期

这可以做到吗?如果是这样,怎么办?

Possible Duplicate:
Can the jQuery UI Datepicker be made to disable Saturdays and Sundays (and holidays)?

I am using jQuery Datepicker.

What i want to do is select a delivery date of today, or tomorrow -

1) It is supposed to blank out the next 3 working days ie if I order Monday my earliest delivery date to choose is Friday.

2) Disable December 20th to 27th 2011 as options

3) Weekends has to be disable

4) all UK holidays has to be disabled

Can this be done? If so, how?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

追风人 2024-12-24 03:51:23

minDate 选项使您能够选择最短日期。

计算下一个工作日更加复杂,特别是如果您想考虑地区假期。这将需要某种服务器端代码,因为不可能以编程方式确定假期是否即将到来。

但是,如果这是您需要的短期解决方案(即从现在到圣诞节购物季结束之间),我只需硬编码一组有效工作日即可将其输入 JavaScript 的 Date对象。循环遍历该数组,找到第一个大于今天日期的日期,然后将两个添加到索引中以获得“从现在开始的三个工作日”。

The minDate option enables you to select a minimum date.

Computing the next business day is more complicated, especially if you want to factor in regional holidays. That will require some kind of server-side code, since it's impossible to determine programmatically if a holiday is coming up.

However, if it's a short-term solution you need (i.e. just between now and the end of the Christmas shopping season), I would simply hard-code an array of valid business days which can be fed into JavaScript's Date object. Loop through that array, find the first date which is greater than today's date, and add two to the index to get "three business days from now".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文