Files
SnowLuma/.pnpm-store/v11/files/dc/192f9bb6f651195b66b84558ec355cc247cdcb2f37fd0ed723f005726b937b13231340efbe27d5eef093700de55d2926ec51f1264f16edb1289738f9fdd317
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +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;