If I enter same date for startdate and enddate fields(ex: startdate is 2012/12/29 and enddate is also 2012/12/29) then the following if condition executes and return false in javascript.
var strtdate = document.getElementById("x_START_DATE").value; //getting task startdate
var enddate = document.getElementById("x_END_DATE").value; //getting task enddate
var task_StartDate = new Date(strtdate);
var task_EndDate = new Date(enddate);
if (task_StartDate.getTime() > task_EndDate.getTime())
{
window.scrollTo(0,0);
alert("End date should not be less than start date.");
return false;
}
and even if I check like this, else part is get executing.
if (task_StartDate.getTime() == task_EndDate.getTime())
{
//some stuff
}
else
{
alert("End date should not be less than start date.");
return false;
}
How to execute code when both dates are equal?