JSFiddle - React, Tailwind, and code Playground

by Lijo

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

isValidDateCheck2('12/33/2012') ;
isValidDateCheck1('12/12/2012') ;

function isValidDateCheck1(d) 
{
  alert(Object.prototype.toString.call(d));
  if ( Object.prototype.toString.call(d) !== "[object Date]" )
  {
    alert('Not Valid');
  }
  if(!isNaN(d.getTime()))
  {
      alert(d.getTime());
  }
}

function  isValidDateCheck2(d)
{    
        var timestamp=Date.parse(d);
        alert(timestamp);

        if (isNaN(timestamp)==false)
        {
            var date=new Date(timestamp);
            alert(date);                    
        }
}