title: `date.setMonth` causes the month to be set too high if `date` is at the end of the month
body: <p>A Date object’s <code>getMonth()</code> method seems to have a bug. Assuming the Date <code>d</code> is <code>2013-01-31</code>, I attempt to set the month on <code>d</code> like this:</p>
  <pre class="lang-js prettyprint-override"><code>const d = new Date(); // 2013-01-31
  
  d.setMonth(8);
  console.log(d.getMonth());
  </code></pre>
  <p>The result is <code>9</code>. Why? I tested this both in Chrome and Firefox.</p>
  <p>I found out that when it’s the 31st, 30th, or 29th of a month, setting the date to a month that has a fewer number of days causes <code>getMonth</code> to return the wrong value.</p>