@transkripid/flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS - Transkrip.id fork
69 lines (68 loc) • 2.5 kB
JavaScript
var g = /* @__PURE__ */ ((e) => (e[e.Days = 0] = "Days", e[e.Months = 1] = "Months", e[e.Years = 2] = "Years", e[e.Decades = 3] = "Decades", e))(g || {}), u = /* @__PURE__ */ ((e) => (e[e.Sunday = 0] = "Sunday", e[e.Monday = 1] = "Monday", e[e.Tuesday = 2] = "Tuesday", e[e.Wednesday = 3] = "Wednesday", e[e.Thursday = 4] = "Thursday", e[e.Friday = 5] = "Friday", e[e.Saturday = 6] = "Saturday", e))(u || {});
const l = (e, n, t) => {
const r = new Date(e.getFullYear(), e.getMonth(), e.getDate()).getTime();
if (n && t) {
const o = new Date(n.getFullYear(), n.getMonth(), n.getDate()).getTime(), a = new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime();
return r >= o && r <= a;
}
if (n) {
const o = new Date(n.getFullYear(), n.getMonth(), n.getDate()).getTime();
return r >= o;
}
if (t) {
const o = new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime();
return r <= o;
}
return !0;
}, y = (e, n) => (e = new Date(e.getFullYear(), e.getMonth(), e.getDate()), n = new Date(n.getFullYear(), n.getMonth(), n.getDate()), e.getTime() === n.getTime()), c = (e, n, t) => (l(e, n, t) || (n && e < n ? e = n : t && e > t && (e = t)), e), D = (e, n) => {
const t = new Date(e.getFullYear(), e.getMonth(), 1);
let o = t.getDay() - n;
return o < 0 && (o += 7), s(t, -o);
}, f = (e, n) => {
const t = [], r = /* @__PURE__ */ new Date(0);
r.setDate(r.getDate() - r.getDay() + n);
const o = new Intl.DateTimeFormat(e, {
weekday: "short"
});
for (let a = 0; a < 7; a++)
t.push(o.format(s(r, a)));
return t;
}, s = (e, n) => {
const t = new Date(e);
return t.setDate(t.getDate() + n), t;
}, h = (e, n) => {
const t = new Date(e);
return t.setMonth(t.getMonth() + n), t;
}, d = (e, n) => {
const t = new Date(e);
return t.setFullYear(t.getFullYear() + n), t;
}, i = (e, n, t) => {
let r = {
day: "numeric",
month: "long",
year: "numeric"
};
return t && (r = t), new Intl.DateTimeFormat(e, r).format(n);
}, F = (e, n) => {
const t = e.getFullYear();
return Math.floor(t / n) * n;
}, T = (e, n) => {
const t = e.getFullYear(), r = n + 9;
return t >= n && t <= r;
};
export {
g as Views,
u as WeekStart,
s as addDays,
h as addMonths,
d as addYears,
c as getFirstDateInRange,
D as getFirstDayOfTheMonth,
i as getFormattedDate,
f as getWeekDays,
y as isDateEqual,
T as isDateInDecade,
l as isDateInRange,
F as startOfYearPeriod
};
//# sourceMappingURL=helpers.mjs.map