monthDelta function

int monthDelta(
  1. Jalali startDate,
  2. Jalali endDate
)

Determines the number of months between two Jalali objects.

For example:

Jalali date1 = Jalali(year: 2019, month: 6, day: 15);
Jalali date2 = Jalali(year: 2020, month: 1, day: 15);
int delta = monthDelta(date1, date2);

The value for delta would be 7.

Implementation

int monthDelta(Jalali startDate, Jalali endDate) {
  return (endDate.year - startDate.year) * 12 + endDate.month - startDate.month;
}