UNPKG

@mantine/dates

Version:

Calendars, date and time pickers based on Mantine components

22 lines (21 loc) 906 B
"use client"; import { DatesProviderContext } from "./DatesProvider.mjs"; import { use, useCallback } from "react"; //#region packages/@mantine/dates/src/components/DatesProvider/use-dates-context.ts function useDatesContext() { const ctx = use(DatesProviderContext); const getLocale = useCallback((input) => input || ctx.locale, [ctx.locale]); const getFirstDayOfWeek = useCallback((input) => typeof input === "number" ? input : ctx.firstDayOfWeek, [ctx.firstDayOfWeek]); const getWeekendDays = useCallback((input) => Array.isArray(input) ? input : ctx.weekendDays, [ctx.weekendDays]); const getLabelSeparator = useCallback((input) => typeof input === "string" ? input : ctx.labelSeparator, [ctx.labelSeparator]); return { ...ctx, getLocale, getFirstDayOfWeek, getWeekendDays, getLabelSeparator }; } //#endregion export { useDatesContext }; //# sourceMappingURL=use-dates-context.mjs.map