datepicker 根据时间禁用日期 [英] datepicker disable date based on time
本文介绍了datepicker 根据时间禁用日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的网站上有一个日期选择器,但现在我想根据时间禁用日期.我想实现两件事:
I have a datepicker on my website but now I want to disable days based on time. I want to achieve 2 things:
- 我想禁用今天,用户应该无法选择今天的日期.
- 每天下午 2:00 之后我也想在明天禁用.
可以通过jquery吗?
Is it possible through jquery?
推荐答案
根据一天中的小时更改 minDate 怎么样?
How about changing minDate according to hour of the day?
var hour = new Date().getHours();
$("element").datepicker({ minDate: hour >= 14 ? 2 : 1});
这篇关于datepicker 根据时间禁用日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文