addYears method

  1. @override
Gregorian addYears(
  1. int years
)
override

Makes a new date object with added years to this date

Original date object remains unchanged

This method is safe

Implementation

@override
Gregorian addYears(int years) {
  if (years == 0) {
    return this;
  } else {
    return Gregorian(
      year + years,
      month,
      day,
      hour,
      minute,
      second,
      millisecond,
    );
  }
}