You can try this code for checking which date value is the highest from two dates with a format MM/DD/YYYY:
function d_check() {
var dl_sdt=document.getElementIdBy("date_input_Id1").value; //date one
var dl_endt=document.getElementIdBy("date_input_Id2").value; //date two
if((dl_sdt.substr(6,4)) > (dl_endt.substr(6,4))) {
alert("first date is greater");
return false;
}
else if((((dl_sdt.substr(0,2)) > (dl_endt.
substr(0,2)))&&(frdt(dl_sdt.substr(3,2)) > (dl_endt.substr(3,2))))||
(((dl_sdt.substr(0,2)) > (dl_endt.substr(0,2)))&&
((dl_sdt.substr(3,2)) < (dl_endt.substr(3,2))))||
(((dl_sdt.substr(0,2)) == (dl_endt.substr(0,2)))&&((dl_sdt.substr(3,2)) >
(dl_endt.substr(3,2))))) {
alert("first date is greater");
return false;
}
alert("second date is digher");
return true;
}
/*for checking this....create a form and give id's to two date inputs.The date format should be mm/dd/yyyy or mm-dd-yyyy or mm:dd:yyyy or mm.dd.yyyy like this. */