Adds a specified number of months to a given date string.
The initial date as a string in the format 'YYYY-MM-DD'.
The number of months to add to the date. Defaults to 0.
The new date as a string in the format 'YYYY-MM-DD'.
const result = addMonth('2023-01-15', 2);console.log(result); // '2023-03-15' Copy
const result = addMonth('2023-01-15', 2);console.log(result); // '2023-03-15'
const result = addMonth('2023-11-30', 3);console.log(result); // '2024-02-29' Copy
const result = addMonth('2023-11-30', 3);console.log(result); // '2024-02-29'
Adds a specified number of months to a given date string.