title: Why does JavaScript interprete 1/1/0000 as 1/1/2000?
body: <p>I encountered some strange behaviour, and while I don't really have an issue with it, I would like to know the reasoning behind it.</p>
  <p>I wrote the following statements:</p>
  <pre><code>console.log(new Date(&quot;0000-1-1&quot;));
  console.log(new Date(&quot;0000-01-01&quot;));
  console.log(new Date(&quot;0000-01-01T00:00:00Z&quot;));
  console.log(new Date(0, 0, 1));
  </code></pre>
  <p>While all dates &quot;appear&quot; to be similar, and if you use normal days/months/years behave the same, it does not in this case.</p>
  <p>The results are the following:</p>
  <pre><code>Sat Jan 01 2000 00:00:00 GMT+0100 (CET)
  Sat Jan 01 0 01:00:00 GMT+0100 (CET)
  Sat Jan 01 0 01:00:00 GMT+0100 (CET)
  Mon Jan 01 1900 00:00:00 GMT+0100 (CET)
  </code></pre>
  <p>Which is quite interesting to me. I can agree with the last one, because the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date" rel="nofollow noreferrer">JavaScript spec</a> clearly says the following:</p>
  <blockquote>
  <p><strong>year</strong></p>
  <p>Integer value representing the year. Values from 0 to 99 map to the years 1900 to 1999. See the example below.</p>
  </blockquote>
  <p>I can also understand the second and third result, since this is depending on the <a href="https://www.rfc-editor.org/rfc/rfc2822#page-14" rel="nofollow noreferrer">RFC 2822</a>. They do accept <code>4*DIGITS</code> as a year, so <code>0000</code> should be the year 0 by the RFC spec (I didn't read it completely though).</p>
  <p>It's only a bit weird that one of the <code>Date</code> constructors can be used for dates above 1900 while the other constructor allows dates from a wider range (RFC).</p>
  <p>However, I do not understand the first result. Where does the year 2000 come from? I do understand that the date is not really an appropriate one, but shouldn't it return <code>Invalid Date</code> in stead of this date?</p>