title: Using isNan and Date.parse to check if a date is valid
body: <p>I'm building something similar to a date picker/ calendar, and I'm using the following expression, to get the data from the input:</p>
  
  <pre><code> isNaN(Date.parse(event.target.value)) ? date = new Date() : new Date(event.target.value);
  </code></pre>
  
  <p>to verify if is a valid date.</p>
  
  <p>But doesn't seems to work, I always get today date.</p>
  
  <p>I saw other solutions regarding calendars, but I don't want to use regex or moments.js or other dependencies. Because I do also a check on the back end, and use a specific format.</p>
  
  <p>My question is more related why isNaN not working as expected, than to date picker. </p>
  
  <p>I'm using the following pattern for the date: 12/11/2014</p>
  
  <p>If I'm trying alos this format 'Aug 9, 1995' and after I use:</p>
  
  <pre><code>day = date.getDate();
  </code></pre>
  
  <p>I get an error: <code>"TypeError: date is undefined"</code>. Date.parse returns <code>807915600000</code></p>
  
  <p>I console.log <code>event.target.value</code> and is ok, no issues on getting the value.</p>