Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
12 lines
396 B
Plaintext
12 lines
396 B
Plaintext
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
|
|
};
|