Check two Dates is Equal in Javascript

function isEqual(startDate, endDate) {
    return endDate.valueOf() == startDate.valueOf();
}

var date1 = new Date('2015-01-28');
var date2 = new Date('2015-01-30');


if(isEqual(date1, date2)){
   console.log('Equal');
}else {
  console.log('not equal')
}

No comments:

Post a Comment