I\'m trying to test to make sure a date is valid in the sense that if someone enters 2/30/2011 then it should be wrong.
2/30/2011
How can I do this with any date?
I just do a remake of RobG solution
var daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31]; var isLeap = new Date(theYear,1,29).getDate() == 29; if (isLeap) { daysInMonth[1] = 29; } return theDay <= daysInMonth[--theMonth]