@konstructio/ui
Version:
A set of reusable and customizable React components built for konstruct.io
35 lines (34 loc) • 737 B
JavaScript
var o = (n) => {
const e = /* @__PURE__ */ new Date(), a = new Date(e.getFullYear(), e.getMonth(), e.getDate());
switch (n) {
case "today":
return {
from: a,
to: a
};
case "current-month":
return {
from: new Date(e.getFullYear(), e.getMonth(), 1),
to: new Date(e.getFullYear(), e.getMonth() + 1, 0)
};
case "last-7-days": {
const t = new Date(a);
return t.setDate(t.getDate() - 6), {
from: t,
to: a
};
}
case "last-2-weeks": {
const t = new Date(a);
return t.setDate(t.getDate() - 13), {
from: t,
to: a
};
}
default:
return {};
}
};
export {
o as calculatePresetRange
};