nextMonth method

DateTime nextMonth (DateTime m)

Retuns a new DateTime in the next calendar month.

If the month is December (12), the retuned DateTime is in the next year

Implementation

static DateTime nextMonth(DateTime m) {
  var year = m.year;
  var month = m.month;

  if (month == 12) {
    year++;
    month = 1;
  } else {
    month++;
  }
  return new DateTime(year, month);
}