function getMondayUtc(input) {
  const d = new Date(Date.UTC(input.getUTCFullYear(), input.getUTCMonth(), input.getUTCDate()));
  const day = d.getUTCDay();
  const diff = day === 0 ? -6 : 1 - day;
  d.setUTCDate(d.getUTCDate() + diff);
  return d;
}
function addUtcDays(input, days) {
  const d = new Date(input);
  d.setUTCDate(d.getUTCDate() + days);
  return d;
}
function getFirstDayOfMonthUtc(input) {
  return new Date(Date.UTC(input.getUTCFullYear(), input.getUTCMonth(), 1));
}
function getFirstDayOfNextMonthUtc(input) {
  return new Date(Date.UTC(input.getUTCFullYear(), input.getUTCMonth() + 1, 1));
}
function getLastNWeekStarts(n, now = /* @__PURE__ */ new Date()) {
  const currentMonday = getMondayUtc(now);
  const starts = [];
  for (let i = n - 1; i >= 0; i--) {
    starts.push(addUtcDays(currentMonday, -i * 7));
  }
  return starts;
}
function toDateOnlyString(date) {
  const y = date.getUTCFullYear();
  const m = String(date.getUTCMonth() + 1).padStart(2, "0");
  const d = String(date.getUTCDate()).padStart(2, "0");
  return `${y}-${m}-${d}`;
}
export {
  addUtcDays,
  getFirstDayOfMonthUtc,
  getFirstDayOfNextMonthUtc,
  getLastNWeekStarts,
  getMondayUtc,
  toDateOnlyString
};
//# sourceMappingURL=dateBuckets.js.map
