const MS_PER_DAY = 864e5;
const RANGE_DAYS = {
  day: 1,
  week: 7,
  month: 30,
  year: 365
};
function isoDate(d) {
  return d.toISOString().slice(0, 10);
}
function resolveTimeRange(range, now = /* @__PURE__ */ new Date()) {
  if (!range) return void 0;
  const days = RANGE_DAYS[range];
  if (!days) return void 0;
  return { fromDate: isoDate(new Date(now.getTime() - days * MS_PER_DAY)) };
}
export {
  resolveTimeRange
};
//# sourceMappingURL=time-range.js.map