title: JavaScript new Date(dateStr) Giving Yesterday's Date in Certain Formats
body: <p><strong>tl;dr</strong> - When I try to create a new Date object with a YYYY-MM-DD format date string, it gives me an incorrect date (yesterday). Why?</p>
  
  <p>I've written the following test code to help me demonstrate the problem I'm perceiving:</p>
  
  <pre><code>var dateConfig = {weekday: "long", year: "numeric", month: "long", day: "numeric"},
      dates = [
          "01/21/2014",
          "01-21-2014",
          "2014/01/21",
          "2014-01-21"
      ];
  
  for (var i = 0; i &lt; dates.length; ++ i) {
      var date = new Date(dates[i]);
      console.log(date.toLocaleDateString("en-US", dateConfig));
  }
  </code></pre>
  
  <p>Link to see for yourself: <a href="http://s.codepen.io/AdrianTP/fullpage/prKyf" rel="noreferrer">http://s.codepen.io/AdrianTP/fullpage/prKyf</a></p>
  
  <p>Chrome <code>31.0.1650.63 m</code> returns the following in the console:</p>
  
  <pre><code>Tuesday, January 21, 2014
  Tuesday, January 21, 2014
  Tuesday, January 21, 2014
  Monday, January 20, 2014 
  </code></pre>
  
  <p>Firefox <code>26.0</code> returns the following in the console:</p>
  
  <pre><code>"Tuesday, January 21, 2014"
  "Invalid Date"
  "Tuesday, January 21, 2014"
  "Monday, January 20, 2014"
  </code></pre>
  
  <p>Even Internet Explorer 8 gets most of it right, returning the following in the console:</p>
  
  <pre><code>"Tuesday, January 21, 2014"
  "Tuesday, January 21, 2014"
  "Tuesday, January 21, 2014"
  "NaN"
  </code></pre>
  
  <p>In short, I am aware that date handling between browsers is inconsistent (dates[2] in Chrome and Firefox differ, and dates[3] just outright breaks in IE 8), but that is not my question.</p>
  
  <p>My question is:</p>
  
  <blockquote>
    <p>Why would Chrome and Firefox return yesterday's date for a YYYY-MM-DD
    formatted date string specifying today's date, when it works fine with
    slashes?</p>
  </blockquote>
  
  <p>Another question:</p>
  
  <blockquote>
    <p>Is this a known issue?</p>
  </blockquote>
  
  <p>I have not encountered it before, and was unable to find any documentation of the issue, nor documentation of the Date() object which would indicate to me that such string-transformation would occur so regularly-irregular. Does anyone out there have experience with this and maybe an explanation or a link to one that I haven't found? I could just be using the wrong search terms here...</p>