add_years
Shifts a date by a whole number of years, forward on a positive amount and back on a negative one.
A warranty and a contract term are stated in years, and the count is usually a field rather than a literal, so writing it as twelve times that field would need arithmetic inside an argument, which an argument cannot hold.
The 29th of February in a year that has one lands on the 28th when the target year does not, on the same rule AddMonths clamps by.
InputArgumentsReturns
Sourcetime.Timeinttime.TimeBasicSource
Shifts by a warranty term read off the row.
Given
{"bought_on": moment, "years": 2}Template
{{ bought_on | add_years:years | date:'Y-m-d' }}Result
2026-03-14