add method

Jalali add (
  1. {int years: 0,
  2. int months: 0,
  3. int days: 0}
)

add days, months and years separately note: it does not make any conversion, it simply adds to each field value for subtracting simple add negative value

UNSAFE

throws on null arguments

non-null

Implementation

Jalali add({int years = 0, int months = 0, int days = 0}) {
  ArgumentError.checkNotNull(years, 'years');
  ArgumentError.checkNotNull(months, 'months');
  ArgumentError.checkNotNull(days, 'days');

  if (years == 0 && months == 0 && days == 0) {
    return this;
  } else {
    return Jalali(year + years, month + months, day + days);
  }
}