* Helper to get the last day of a month.
(year: number, month: number)
| 1415 | * Helper to get the last day of a month. |
| 1416 | */ |
| 1417 | function getLastDayOfMonth(year: number, month: number): number { |
| 1418 | // Month is 1-indexed (1 = January) |
| 1419 | // Create date for first day of next month, then go back one day |
| 1420 | return new Date(Date.UTC(year, month, 0)).getUTCDate(); |
| 1421 | } |
| 1422 | |
| 1423 | /** |
| 1424 | * Add months to a date with proper month-end handling. |