If you can count on the string input being formatted as digits (no weekday or month names), you can look at the input before creating a Date object.
function validDate(s){
//check for day-month order:
var ddmm= new Date('12/6/2009').getMonth()=== 5;
//arrange month,day, and year digits:
var A= s.split(/\D+/).slice(0, 3),
month= ddmm? A[1]: A[0],
day= ddmm? A[0]: A[1],
y= A.pop(),
//figure february for given year:
feb= y%4== 0 && (y%100 || y%400== 0)? 29: 28,
// set maximum days per month:
mdays= [0, 31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
//if the string is a valid calendar date, return a date object.
//else return NaN (or throw an Error):
return mdays[parseInt(month, 10)]-A[1]>= 0? new Date(s): NaN;
}
validDate('02/29/2015')
/* returned value: (Number)
NaN
*/