import u from "./index-toInteger.js";
import f from "./index-toDate.js";
import s from "./index-requiredArgs.js";
function h(n, o) {
  s(2, arguments);
  var t = f(n), r = u(o);
  if (isNaN(r))
    return /* @__PURE__ */ new Date(NaN);
  if (!r)
    return t;
  var a = t.getDate(), e = new Date(t.getTime());
  e.setMonth(t.getMonth() + r + 1, 0);
  var i = e.getDate();
  return a >= i ? e : (t.setFullYear(e.getFullYear(), e.getMonth(), a), t);
}
export {
  h as default
};
