@mantine/dates
Version:
Calendars, date and time pickers based on Mantine components
22 lines (21 loc) • 1.04 kB
JavaScript
"use client";
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
const require_is_month_disabled = require("../is-month-disabled/is-month-disabled.cjs");
let dayjs = require("dayjs");
dayjs = require_runtime.__toESM(dayjs);
//#region packages/@mantine/dates/src/components/MonthsList/get-month-in-tab-order/get-month-in-tab-order.ts
function getMonthInTabOrder({ months, minDate, maxDate, getMonthControlProps }) {
const enabledMonths = months.flat().filter((month) => !require_is_month_disabled.isMonthDisabled({
month,
minDate,
maxDate
}) && !getMonthControlProps?.(month)?.disabled);
const selectedMonth = enabledMonths.find((month) => getMonthControlProps?.(month)?.selected);
if (selectedMonth) return selectedMonth;
const currentMonth = enabledMonths.find((month) => (0, dayjs.default)().isSame(month, "month"));
if (currentMonth) return currentMonth;
return enabledMonths[0];
}
//#endregion
exports.getMonthInTabOrder = getMonthInTabOrder;
//# sourceMappingURL=get-month-in-tab-order.cjs.map