Sets the month of the given date (1-based, e.g. 1 = January) and returns a new Date instance.
The original date.
The month to set (1–12).
A new Date with the updated month.
setMonth(new Date('2025-01-01'), 12); // → 2025-12-01 Copy
setMonth(new Date('2025-01-01'), 12); // → 2025-12-01
Sets the month of the given date (1-based, e.g. 1 = January) and returns a new Date instance.