Who will answer my question?
How can I validate a date using Javascript cross browser?
I use a invalid date: 2011-11-31 like below:
var d = new Date("2012-11-31")
In FF:
d = NaN // Date is invalid
In Chrome:
d.getFullYear();//2012
d.getDate();//1
d.getMonth();//11
Tested in IE7-9, chrome, opera, safari, firefox. Test here: http://jsfiddle.net/MRwAq/
You could do it like this:
Then: