Compare dd/mm/yyyy date



var d1 = "22/04/2018";
var d2 = "29/04/2018";

var arrStartDate = d1.split("/");
var arrEndDate = d2.split("/");
       
 var date1 = new Date(arrStartDate[2], arrStartDat
e[1], arrStartDate[0]);
 var date2 = new Date(arrEndDate[2], arrEndDate[1], arrEndDate[0]);
    if (date1 > date2) {
        alert("Date from must be less than Date to ");
       
    }


No comments:

Post a Comment