daysBetweenMonth static method

int daysBetweenMonth(
  1. DateTime a,
  2. DateTime b
)

计算两个日期相差多少月

Implementation

static int daysBetweenMonth(DateTime a, DateTime b) {
  int v = a.millisecondsSinceEpoch - b.millisecondsSinceEpoch;
  return v ~/ 86400000 * 30;
}