JSFiddle - React, Tailwind, and code Playground

HTML

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.8.1.js"></script>
   
</head>
    
<body>
   
</body>
</html>

JavaScript

alert('1  '+  isValidDate('Thursday, January 3,2017') );
alert('2  '+isValidDate('2/29/2011') );
alert('3  '+isValidDate('2/1/-2011') );
alert('4  '+isValidDate('2/1/2011B') );

alert('5  '+isValidDate('2/29/2012') );
alert('6  '+isValidDate(' 2 / 27 / 2012 ') );


function isValidDate(s) 
{
    var bits = s.split('/');
    
    if(s.indexOf(' ') != -1)
    {
        //White space exists in the original date string
        return false;
    }
 
    //Javascript month starts at zero
    var d = new Date(bits[2], bits[0] - 1, bits[1]);
 
 
    if ( isNaN( Number(bits[2]) ) ) 
    {
        //Year is not valid number
        return false;
    }
 
    if ( Number(bits[2]) < 1 ) 
    {
        //Year should be greater than zero
        return false;
    }
      
    
 
    //1. Check whether the year is a Number
    //2. Check whether the date parts are eqaul to original date components
    //3. Check whether d is valid
 
    return d && ( (d.getMonth() + 1) == bits[0]) && (d.getDate() == Number(bits[1]) );
 
}