如何在Bootstrap Datepicker中停用上一个日期? [英] How to inactive previous date in Bootstrap datepicker?
本文介绍了如何在Bootstrap Datepicker中停用上一个日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Bootstrap datepicker,并且我想停用上一个日期.意味着用户不应选择前一天.我希望它能够开发功能来安排一些用户的工作.
I'm using Bootstrap datepicker and I want to inactive previous date. Means the user should not be able to select the previous day. I want this to develop functionality to schedule some users work.
我需要做什么?
推荐答案
以下代码将禁用今天之后的日期.
The following code will disable date after today.
var nowTemp = new Date();
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
$('#myId').datepicker({
format: 'dd-mm-yyyy',
onRender: function(date) {
return date.valueOf() > now.valueOf() ? 'disabled' : '';
}
});
这篇关于如何在Bootstrap Datepicker中停用上一个日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文