Files
NapCatQQ/.pnpm-store/v3/files/dc/192f9bb6f651195b66b84558ec355cc247cdcb2f37fd0ed723f005726b937b13231340efbe27d5eef093700de55d2926ec51f1264f16edb1289738f9fdd317
TanTan e311ca3275
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
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

11 lines
407 B
Plaintext

"use strict";
const daysInMonth = require("./daysInMonth.js");
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;
}
module.exports = addMonths;