addMonthsToMonthDate function

Jalali addMonthsToMonthDate(
  1. Jalali monthDate,
  2. int monthsToAdd
)

Returns a Jalali with the added number of months and truncates any day and time information.

For example:

Jalali date = Jalali(year: 2019, month: 1, day: 15);
Jalali futureDate = _addMonthsToMonthDate(date, 3);

date would be January 15, 2019. futureDate would be April 1, 2019 since it adds 3 months and truncates any additional date information.

Implementation

Jalali addMonthsToMonthDate(Jalali monthDate, int monthsToAdd) {
  return Jalali(monthDate.year, monthDate.month).addMonths(monthsToAdd);
}