If you're looking at how to test whether or not a date is valid, use this JavaScript function below to test your dates. Any recommendations, improvements etc are welcome.
function isDate(year, month, day) { month = month - 1; // javascript month range 0 - 11 var tempDate = new Date(year,month,day); if ( (year == tempDate.getFullYear()) && (month == tempDate.getMonth()) && (day == tempDate.getDate()) ) { return true; } else { return false; } }
revision 1
Date.isValid = function(year, month, day) { month -= 1; // javascript month range 0 - 11 var tempDate = new Date(year,month,day); if ( (year == tempDate.getFullYear()) && (month == tempDate.getMonth()) && (day == tempDate.getDate()) ) { return true; } else { return false; } }
revision 2