title: startOfMonth returns last day of month before
body: <p>So it's pretty straight forwards:</p>
  
  <pre><code>import startOfMonth from 'date-fns/start_of_month';
  
  export const getFirstDayThisMonth = date =&gt; {
    const firstDay = startOfMonth(date);
    return firstDay;
  };
  </code></pre>
  
  <p>given input (for example):<br>
  <code>1987-02-02T00:00:00.000Z</code></p>
  
  <p>it returns:<br>
  <code>1987-01-31T23:00:00.000Z</code></p>
  
  <p>The error is reproduced exactly when trying to produce the first date according to the method mentioned in <a href="https://stackoverflow.com/a/13572682/4136445">this answer</a>:</p>
  
  <pre><code>var date = new Date();
  var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
  </code></pre>
  
  <p>The error comes when running jest-tests and can't be reproduced in the console where it works as expected:</p>
  
  <pre><code>const day1 = new Date('1987-02-02');
  undefined
  const day2 = new Date(day1.getFullYear(),day1.getMonth(),1)
  undefined
  day2
  Sun Feb 01 1987 00:00:00 GMT+0100 (Central European Standard Time)
  </code></pre>
  
  <hr>
  
  <p>If in the second solution I also set the fourth argument (hour) to 1, it correctly handles:</p>
  
  <p><code>1987-02-02T00:00:00.000Z</code><br>
  returning <code>1987-02-01T00:00:00.000Z</code>  </p>
  
  <p>and</p>
  
  <p><code>2001-03-03T00:00:00.000Z</code><br>
  returning <code>2001-03-01T00:00:00.000Z</code></p>
  
  <p>but </p>
  
  <p><code>2002-04-04T00:00:00.000Z</code><br>
  returns <code>2002-03-31T23:00:00.000Z</code></p>
  
  <p>I'm really at loss as to what could be causing this issue, it feels like there's some rollover to the previous date when the time is set to 00:00:00?</p>
  
  <hr>
  
  <p>Per request, here's the <code>date-fns</code>-code for startOfMonth:</p>
  
  <pre><code>function startOfMonth (dirtyDate) {
    var date = parse(dirtyDate)
    date.setDate(1)
    date.setHours(0, 0, 0, 0)
    return date
  }
  </code></pre>
  
  <hr>
  
  <p>I really don't get why</p>
  
  <pre><code>var date = new Date();
  var firstDay = new Date(date.getFullYear(), date.getMonth(), 1, 1);
  </code></pre>
  
  <p>seem to work on feb-march but not on april?</p>