addMonths method

MonthAndYear addMonths(
  1. int months
)

Implementation

MonthAndYear addMonths(int months) {
  final newYear = year + (month + months - 1) ~/ 12;
  final newMonth = (month + months - 1) % 12 + 1;

  return MonthAndYear(
    month: newMonth,
    year: newYear,
  );
}