monthsFromNow method

DateTime monthsFromNow (int months)

Return the point in time months from now on the same date.

Implementation

DateTime monthsFromNow(int months) {
  var time = now();
  var m = (time.month + months - 1) % 12 + 1;
  var y = time.year + (months + time.month - 1) ~/ 12;
  var d = clampDayOfMonth(year: y, month: m, day: time.day);
  return new DateTime(
      y, m, d, time.hour, time.minute, time.second, time.millisecond);
}