Returns the year calculated date with the source date and the specified amount
If the target year does not have the same day (e.g. Feb 29 in a non-leap year), the result is clamped to the last day of the target month
Optional
The date to inspect
The amount to add, negative number means minus
the year calculated date with the source date and the specified amount
David Hsing
addYear(new Date(2023, 8, 30), 1); // Date(2024, 8, 30)addYear(new Date(2024, 1, 29), 1); // Date(2025, 1, 28) Copy
addYear(new Date(2023, 8, 30), 1); // Date(2024, 8, 30)addYear(new Date(2024, 1, 29), 1); // Date(2025, 1, 28)
Returns the year calculated date with the source date and the specified amount
If the target year does not have the same day (e.g. Feb 29 in a non-leap year), the result is clamped to the last day of the target month