laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
22 lines (21 loc) • 552 B
JavaScript
"use client";
import { constructFrom as n } from "./constructFrom.js";
import { toDate as h } from "./toDate.js";
function d(a, f, e) {
const r = h(a, e == null ? void 0 : e.in);
if (isNaN(f)) return n((e == null ? void 0 : e.in) || a, NaN);
if (!f)
return r;
const c = r.getDate(), t = n((e == null ? void 0 : e.in) || a, r.getTime());
t.setMonth(r.getMonth() + f + 1, 0);
const u = t.getDate();
return c >= u ? t : (r.setFullYear(
t.getFullYear(),
t.getMonth(),
c
), r);
}
export {
d as addMonths,
d as default
};