I am trying to validate my StartDate and EndDate entries in my form. I want to make sure EndDate entry is later than the StartDate entry. The below works except if someone enters 03/4/04 instead of 03/04/04. Basically any single day entry without a zero in front of it ruins my validation. Please advise of a better validation or how I can get this to work?
Code:
function checkDate()
{
var f = document.forms[0];
if (f.EndDate.value >= f.StartDate.value)
{
return true;
}
else
{
alert("End Date must be after Start Date.\n");
return false;
}
}