import React from "react"; import { Button } from "../UI/Button"; const WEEK_DAY_LABELS = ["ПН", "ВТ", "СР", "ЧТ", "ПТ", "СБ", "ВС"]; const toDateKey = (date) => { const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, "0"); const day = String(date.getDate()).padStart(2, "0"); return `${year}-${month}-${day}`; }; const isWeekendDate = (date) => { const day = date.getDay(); return day === 0 || day === 6; }; const isSelectableCalendarDate = (date, minDateKey) => { const dateKey = toDateKey(date); return dateKey >= minDateKey && !isWeekendDate(date); }; const formatDateForDisplay = (value) => { if (!value) { return "Выберите дату"; } const [year, month, day] = value.split("-").map(Number); if (!year || !month || !day) { return value; } return new Date(year, month - 1, day).toLocaleDateString("ru-RU", { day: "2-digit", month: "2-digit", year: "numeric", }); }; const CalendarWidget = ({ label, selectedDate, onDateChange, minDateKey, isCalendarOpen, setIsCalendarOpen, currentMonth, setCurrentMonth, calendarDays, monthLabel, canGoBack, timeOptions, selectedTime, onTimeChange, layoutClassName, calendarClassName, timeClassName, }) => { return (
{label}
Выходные отмечены пунктиром и недоступны.