I have two date in which one is dd-mm-yyyy hh:mm
format and another in dd-mm-yyyy (D1)
format
fristly i split the dd-mm-yyyy hh:mm
fo
dateFirst = D1.split('-');
dateSecond = D2.split('-');
var value = new Date(dateFirst[2], dateFirst[1], dateFirst[0]); //Year, Month, Date
var current = new Date(dateSecond[2], dateSecond[1], dateSecond[0]);
than use the if condition
if(D2<=D1)
{
console.log('ok');
}
else
{
console.log('something is wrong');
}