在下面的代码中,我使用太平洋/奥克兰的时区,根据他们今天的时区日期,即11-4-4-2017已经完成,现在他们的日期是12-4-2017,但在我的日期选择器中,11-4-4没有被禁用。我需要禁用之前的日期,即2017年4月11日。
这是我的日期选择器代码
.datepicker({
autoclose: true,
todayHighlight: true,
startDate: new Date().toLocaleString('en-NZ', { timeZone: 'Pacific/Auckland' })
})发布于 2017-04-11 21:44:25
只需在startDate属性中支持从今天起的一天(新日期())即可完成此操作。
在客户端尝试从今天的日期减去一天;
.datepicker({
autoclose: true,
todayHighlight: true,
startDate: new Date().setDate(new Date().getDate()-1).toLocaleString('en-NZ', { timeZone: 'Pacific/Auckland' })
})发布于 2017-04-11 21:49:01
minDate选项就是您要找的。
.datepicker({
autoclose: true,
todayHighlight: true,
minDate: new Date().setDate(new Date().getDate()-1).toLocaleString('en-NZ', { timeZone: 'Pacific/Auckland' })
})发布于 2017-04-11 21:57:46
您必须使用minDate创建它
.datepicker({
autoclose: true,
todayHighlight: true,
minDate: // whatever you choose,
startDate: new Date().setDate(new Date().getDate()-1).toLocaleString('en-NZ', { timeZone: 'Pacific/Auckland' })
})https://stackoverflow.com/questions/43347711
复制相似问题