import daysInMonth from "./daysInMonth.mjs"; function addMonths(date, months) { const expectedMonth = date.getMonth() + months; const tempMaxDay = daysInMonth(new Date(date.getFullYear(), expectedMonth, 1, 0, 0, 0, 0)); const currentDay = date.getDate(); date.setMonth(expectedMonth, currentDay > tempMaxDay ? tempMaxDay : currentDay); return date; } export { addMonths as default };