Name of the blog

Short description of the blog

Date Range Validation

Here is a Javascript function that validates two dates and indicates if they form a valid date range.

function isValidDateRange( objstartMonth, objstartDay, objstartYear, objendMonth, objendDay, objendYear)
{

var startDate = new Date(objstartYear.options[objstartYear.selectedIndex].value,objstartMonth.options[objstartMonth.selectedIndex].value,objstartDay.options[objstartDay.selectedIndex].value);
var endDate = new Date(objendYear.options[objendYear.selectedIndex].value,objendMonth.options[objendMonth.selectedIndex].value,objendDay.options[objendDay.selectedIndex].value);

if (startDate>=endDate)
{

alert("Invaild Date Range");

return false;

}

else

{

return true;
}

}

Loading