Does anyone know why in Firefox, if you execute the code below, it will check it as a date if the string is passed in four numbers and only four numbers? In every other browser that I tested with (IE, Chrome), it will always return as not a date.
Being that the specification, as Marcel Corpel points out below, states that it should return to using spam specific to the implementation of Firefox, I really wonder why Firefox is dropping, shows 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!");
}
}
source
share