addYears method

LocalDate addYears(
  1. int years
)

Returns a new LocalDate representing the current value with the given number of years added.

If the resulting date is invalid, lower fields (typically the day of month) are reduced to find a valid value. For example, adding one year to February 29th 2012 will return February 28th 2013; subtracting one year from February 29th 2012 will return February 28th 2011.

  • years: The number of years to add

Returns: The current value plus the given number of years.

Implementation

LocalDate addYears(int years) => DatePeriodFields.yearsField.add(this, years);