title: Javascript not taking day in Date() constructor correctly
body: <p>I am developing an API where a user can ask for transactions in a given year and month. The API looks like  </p>
  
  <pre><code>routes.get('/transactions/:member_id/:year/:month', (req, res) =&gt; {
      let {member_id, year, month} = req.params;
      let start_date = new Date(year, month - 1, 1);
      let end_date = moment(start_date).add(1, 'months');
  
      console.log({start_date, end_date});
      res.send({start_date, end_date})
  });
  </code></pre>
  
  <p>I  am using <code>ExpressJS</code> to build API and <code>momentjs</code> to manipulate dates.    </p>
  
  <p>When I hit this api as  <a href="http://localhost:8080/transactions/m/2017/10" rel="nofollow noreferrer">http://localhost:8080/transactions/m/2017/10</a>, I ask transactions for user <code>m</code>, year <code>2017</code> and month <code>10</code> which is October (this is why I do <code>month - 1</code> in my implementation above).  </p>
  
  <p>What I get back in <code>console</code> is  </p>
  
  <pre><code>{ start_date: 2017-09-30T11:00:00.000Z,
    end_date: moment("2017-11-01T00:00:00.000") }
  </code></pre>
  
  <p>I am confused because start day of the month has been hardcoded as <code>1</code>   </p>
  
  <pre><code>let start_date = new Date(year, month - 1, 1);  
  </code></pre>
  
  <p>and not <code>30</code>. What is going wrong here?</p>