Files
NapCatQQ/.pnpm-store/v3/files/41/aad4bb7d5ecb722db1c84eaf157093959522b211e82eb95aa8c474cdc1c0503414938dbecc08cc46cef00f7a226442cbf88e060c58be31901232fbe919e418
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

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
};