getMonthDifference static method
Calculates the difference in months between two dates.
Implementation
static int getMonthDifference({
required DateTime startDate,
required DateTime endDate,
}) {
final monthsDifference =
(endDate.year - startDate.year) * 12 + endDate.month - startDate.month;
return monthsDifference.abs();
}