I have this two dates which I am getting through input field through javascript
var Date1 = document.nocAddition.Date1.value;
var Date2 = document.nocAddition.Date2.value;
I am trying to validate that Date 1 should always be more than date 2 and I am doing by the writing the below code:
var dateA = new Date(Date1);
var dateB = new Date(Date2);
if(Date.parse(dateA) < Date.parse(dateB)){
alert('start is less than End');
return false;
} else {
alert('end is less than start');
return false;
}
But the it is not matching the condition in loop and always alerting after else. Is there any new way to compare two dates through Javascript? Please help.