addMonths method

  1. @override
DateTime addMonths(
  1. DateTime date,
  2. int months
)
override

This mixin's implementation of Every.next and Every.previous.

Implementation

@override
DateTime addMonths(DateTime date, int months) {
  if (months == 0) return startDate(date);
  if (months.isNegative) {
    if (months == -1) return previous(date);
    return previous(addMonths(date, months + 1));
  }
  return next(addMonths(date, months - 1));
}