calculateMonthDifference static method

int calculateMonthDifference(
  1. DateTime dateA,
  2. int xMilliseconds
)

Implementation

static int calculateMonthDifference(DateTime dateA, int xMilliseconds) {
  DateTime targetDate = dateA.add(Duration(milliseconds: xMilliseconds));
  int yearDiff = dateA.year - targetDate.year;
  int monthDiff = dateA.month - targetDate.month;
  int totalMonths = yearDiff * 12 + monthDiff;
  return totalMonths;
}