subtractMonths method

MonthAndYear subtractMonths(
  1. int months
)

Implementation

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

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