monthsDiffrenceTo method

int monthsDiffrenceTo(
  1. DateTime date
)

Calculates the difference in months between this date and other.

If the returned int is a positive number, this is before other, and vice-versa.

Implementation

int monthsDiffrenceTo(DateTime date) =>
    12 * (date.year - year) + date.month - month;