monthsFromNow method

DateTime monthsFromNow(
  1. 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 DateTime(
      y, m, d, time.hour, time.minute, time.second, time.millisecond);
}