The Date type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like UTCDate.
Date
UTCDate
The result Date type.
The date to be changed
The amount of years to be added.
Optional
The options
The new date with the years added
addYears
Add the specified number of years to the given date.
// Add 5 years to 1 September 2014:const result = addYears(new Date(2014, 8, 1), 5)//=> Sun Sep 01 2019 00:00:00 Copy
// Add 5 years to 1 September 2014:const result = addYears(new Date(2014, 8, 1), 5)//=> Sun Sep 01 2019 00:00:00
The
Date
type, the function operates on. Gets inferred from passed arguments. Allows to use extensions likeUTCDate
.