addMonths method

CalendarMonth addMonths(
  1. int months
)

Adds the given number of months to this month. For instance:

<Mar 2015>.addMonths(4) --> Jul 2015
<Mar 2015>.addMonths(-3) --> Dec 2014

Implementation

CalendarMonth addMonths(int months) {
  var newYear = year + (months / 12).floor();
  var newMonth = month + months % 12;
  if (newMonth > 12) {
    newYear++;
    newMonth -= 12;
  }
  return CalendarMonth(newYear, newMonth,
      state: calendarState, startingWeekday: startingWeekday);
}