diffMonth method

int diffMonth(
  1. DateTime d
)

Implementation

int diffMonth(DateTime d) {
  DateTime start = this;
  DateTime end = d;
  if (start.millisecondsSinceEpoch > end.millisecondsSinceEpoch) {
    var b = end;
    end = start;
    start = b;
  }
  int yearCount = end.year - start.year;
  int monthCount = end.month - start.month;
  return monthCount + yearCount * 12;
}