Here is the relevant code:
value = value.replace(/'\'/, "/");
var arrayDateParts = value.split("/");
var intMonth = arrayDateParts[0];
var intDay = arrayDateParts[1];
var intYear = arrayDateParts[2];
var arrayDaysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31];
if ( (!(intYear % 4) && intYear % 100) || !(intYear % 400))
{
arrayDaysInMonth[1] = 29;
}
var bitValid = new Date(value);
if (intDay > arrayDaysInMonth[--intMonth] || isNaN(bitValid) == true || value.trim() == "") {
strError = "The field " + name + " must be a valid date";
document.getElementById("hid" + FieldName).value = 1;
document.getElementById(ID).style.backgroundColor = '#FF5353';
}
when inputting 9/31/2013, it flags as invalid, as it should. When putting in 1/31/2013, it flags as valid, which it should. I put in 10/31/2013, and it says invalid.
I change the intDay>arrayDaysInMonth[--intMonth] to parseInt() for both, still flags as invalid. intDay = 31 as does arrayDaysInMonth[--intMonth] when doing an alert to the screen.
I'm at a loss. Any ideas? All other dates work as expected that I can tell