The code is very simple, so I won’t talk much nonsense here, just present the code:
The code copy is as follows:
function checkDate(){
//replace(//-/g, "//") is to convert dates into long date format based on verification expressions
var sDate = new Date(document.getElementById_x("datetimepickerStart").value.replace(//-/g, "//"));
var eDate = new Date(document.getElementById_x("datetimepickerEnd").value.replace(//-/g, "//"));
if(sDate > eDate)
{
alert("The end date shall not be less than the start date!");
return false;
}
return true;
}
Isn’t it very simple? Friends can freely use it and use it in their own projects.