fui-fancyui
Version:
FancyUI Libary
21 lines (20 loc) • 875 B
JavaScript
"use client";
import { jsx as o } from "react/jsx-runtime";
import { useState as f, useEffect as l } from "react";
import u from "../Typography/Typography.js";
import { WeekdaysConatiner as g } from "./Weekdays.style.js";
import { sizeSettings as h } from "./sizeSettings.js";
function W(a) {
const { themeType: s, layer: n, sizeC: i = "md", border: m = "bottom", startWeekOn: r = 1 } = a, [c, p] = f([]);
return l(() => {
const e = [], y = new Date(1970, 0, (r + 4) % 7);
for (let t = 0; t < 7; t++) {
const d = new Date(y.getTime() + t * 24 * 60 * 60 * 1e3);
e.push(d.toLocaleString(navigator.language, { weekday: "short" }).slice(0, 2));
}
p(e);
}, [r]), /* @__PURE__ */ o(g, { $themeType: s, $layer: n, $border: m, children: c.map((e) => /* @__PURE__ */ o(u, { variant: h[i].fontSize, children: e }, e)) });
}
export {
W as default
};