@mantine/dates
Version:
Calendars, date and time pickers based on Mantine components
14 lines (13 loc) • 610 B
JavaScript
"use client";
import dayjs from "dayjs";
//#region packages/@mantine/dates/src/components/WeekdaysRow/get-weekdays-names/get-weekdays-names.ts
function getWeekdayNames({ locale, format = "dd", firstDayOfWeek = 1 }) {
const baseDate = dayjs().day(firstDayOfWeek);
const labels = [];
for (let i = 0; i < 7; i += 1) if (typeof format === "string") labels.push(dayjs(baseDate).add(i, "days").locale(locale).format(format));
else labels.push(format(dayjs(baseDate).add(i, "days").format("YYYY-MM-DD")));
return labels;
}
//#endregion
export { getWeekdayNames };
//# sourceMappingURL=get-weekdays-names.mjs.map