//设置日期只能选择今天以前
<input name="fieldSignTime" id="fieldSignTime" class="easyui-datebox" data-options="editable:false">
$('#fieldSignTime').datebox('setValue', getCurentDateStr());
$('#fieldSignTime').datebox('calendar').calendar({
validator: function (date) {
var now = new Date();
var d1 = new Date(now.getFullYear(), now.getMonth(), now.getDate());
return date <= d1;
}
});
function getCurentDateStr() {
var now = new Date();
var year = now.getFullYear(); //年
var month = now.getMonth() + 1; //月
var day = now.getDate(); //日
var clock = year + "-";
if (month < 10) clock += "0";
clock += month + "-";
if (day < 10) clock += "0";
clock += day;
return clock;
}
Easyui datebox只能选择今天以前的日期
最新推荐文章于 2024-08-12 19:37:13 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)