In web development, sometimes it is necessary to compare the time in the input box (mainly the start time and the end time). After searching online, I found that many of them are invalid. The following methods are indeed effective after verification by me. I will share them here. (Please pay attention to the red section)
var d2 = new Date(('txbToDate').(/\-/g, "\/"));
if(d1>d2)
{
alert("The end time must be after the start time!");
return false;
}
return true;
}
function ValidtorTime(){
var d2 = new Date(('txbToDate').(/\-/g, "\/"));
if(d1>d2)
{
alert("The end time must be after the start time!");
return false;
}
return true;
}