title: How to check if new Date("some date") was able to parse correctly?
body: <p>I have the following code, which is supposed to try to parse a given date. If it fails, it defaults to the current date:</p>
  
  <pre><code>var date = new Date(textbox.value); // Try to parse
  if (isNaN(date)) date = new Date(); // Default to current
  </code></pre>
  
  <p>Now i'm using isNaN() to test if it was able to parse correctly, eg  to check that new Date() didn't return 'Invalid Date'.</p>
  
  <p>This seems to work fine on IE, FF, and Chrome, but doesn't work on safari. Eg if it tries to parse an empty string for the date, sometimes it think's it's 1970, and sometimes it thinks it's an invalid date. Here's an exerpt from the safari JS console:</p>
  
  <pre><code>a=new Date("")  &lt;-- This thinks it's 1970 for some reason
  Thu Jan 01 1970 11:00:00 GMT+1100 (AUS Eastern Daylight Time)
  
  b=new Date("abc") &lt;-- Fails of course, which is good
  Invalid Date
  
  c=new Date("") &lt;-- Why does this fail now, whereas it thought it was 1970 before?
  Invalid Date
  
  isNaN(a)  &lt;-- Why is it successfully parsing an empty string for a date?
  false
  
  isNaN(b)  &lt;-- Fair enough
  true
  
  isNaN(c)  &lt;-- This is what i'd expect, but why is it different now?
  true
  </code></pre>
  
  <p>Not sure whats happening here, thanks a lot</p>