UNPKG

@mantine/dates

Version:

Calendars, date and time pickers based on Mantine components

34 lines (33 loc) 1.22 kB
"use client"; const require_to_date_string = require("../../utils/to-date-string/to-date-string.cjs"); let react_jsx_runtime = require("react/jsx-runtime"); //#region packages/@mantine/dates/src/components/HiddenDatesInput/HiddenDatesInput.tsx function formatValue({ value, type, withTime }) { const formatter = withTime ? require_to_date_string.toDateTimeString : require_to_date_string.toDateString; if (type === "range" && Array.isArray(value)) { const startDate = formatter(value[0]); const endDate = formatter(value[1]); if (!startDate) return ""; if (!endDate) return `${startDate} –`; return `${startDate}${endDate}`; } if (type === "multiple" && Array.isArray(value)) return value.filter(Boolean).join(", "); if (!Array.isArray(value) && value) return formatter(value); return ""; } function HiddenDatesInput({ value, type, name, form, withTime = false }) { return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", { type: "hidden", value: formatValue({ value, type, withTime }), name, form }); } HiddenDatesInput.displayName = "@mantine/dates/HiddenDatesInput"; //#endregion exports.HiddenDatesInput = HiddenDatesInput; //# sourceMappingURL=HiddenDatesInput.cjs.map