Does anyone know why in Firefox if you execute the code below it will validate it as a date if the string passed in is four numbers and only four numbers? In every other browser I tested with (IE, Chrome) it will always return as not a date.
Being that the spec, as pointed out by Marcel Korpel below, states that it should fall back to use the Firefox's implementation-specific fall back I am really wondering why Firefox's fall back displays this anomaly.
function isDate(sDate) {
var temp = new Date(sDate);
if (temp.toString() == "NaN" || temp.toString() == "Invalid Date") {
alert("Not a Date");
} else {
alert("Is a Date!");
}
}