easyui 日期約束-當前日期以後不可選中
阿新 • • 發佈:2019-02-02
//日期限值判定
$('#endTime').datebox('calendar').calendar({
validator: function(date)
{
var now = new Date();
now = now.toLocaleDateString().replace("/", "-");
now = now.replace("/", "-");
now = now.replace(/\-/gi,"/");
now = new Date(now).getTime();
//date = date.replace(/\-/gi,"/");
date = new Date(date).getTime();
if (date > now)
{
return false;
}
else
{
return true;
}
}
});
$('#startTime').datebox('calendar').calendar({
validator: function(date)
{
var now = new Date();
now = now.toLocaleDateString().replace("/", "-");
now = now.replace("/", "-");
now = now.replace(/\-/gi,"/");
now = new Date(now).getTime();
//date = date.replace(/\-/gi,"/");
date = new Date(date).getTime();
if (date > now)
{
return false;
}
else
{
return true;
}
}
});
$('#endTime').datebox('calendar').calendar({
validator: function(date)
{
var now = new Date();
now = now.toLocaleDateString().replace("/", "-");
now = now.replace("/", "-");
now = now.replace(/\-/gi,"/");
now = new Date(now).getTime();
//date = date.replace(/\-/gi,"/");
date = new Date(date).getTime();
if (date > now)
{
return false;
}
else
{
return true;
}
}
});
$('#startTime').datebox('calendar').calendar({
validator: function(date)
{
var now = new Date();
now = now.toLocaleDateString().replace("/", "-");
now = now.replace("/", "-");
now = now.replace(/\-/gi,"/");
now = new Date(now).getTime();
//date = date.replace(/\-/gi,"/");
date = new Date(date).getTime();
if (date > now)
{
return false;
}
else
{
return true;
}
}
});