I want to check whether end date is greater than or equal to start date, with jquery validate. It is validating end date greater than start date, but it is not permitting en
If you want to use simple javascript to compare ethe date. Here is one; simple and easier.
function compareDate() {
var str = document.getElementById("start_date").value;
var end = document.getElementById("end_date").value;
var year = str.substring(0,4);
var month = str.substring(5,7);
var date = str.substring(8,10);
var endYear = end.substring(0,4);
var endMonth = end.substring(5,7);
var endDate = end.substring(8,10);
var startDate = new Date(year, month-1, date);
var endDate = new Date(endYear, endMonth-1, endDate);
if (startDate > endDate) {
alert('start date should be less than end date');
return false;
}
else { return true; }
}