title: Javascript moment - subtract month at year transition
body: <p>I use moment at my javascript application and my code looks like this (at bottom)
  When vm.reportMonth is 1 (Januar) and vm.reportYear is e.g. 2017 and the function oneMonthBack is invoced that previousDate should be december 2016, but it is still january 2017.
  What I am doing wrong?</p>
  
  <pre><code>function oneMonthBack() { 
      var currentDate = moment().set('month', vm.reportMonth).set('year', vm.reportYear);
      var previousDate = currentDate.subtract(1, 'months');
      var month = previousDate.get('month');
      var year = previousDate.year();
      vm.reportMonth = month;
      vm.reportYear = year;
  </code></pre>