From e78b5297ac1dfbe7926b37367b45e9541f58348b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AD=B1=E9=87=8E?= Date: Sun, 12 Oct 2025 22:52:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E4=B8=AA=E6=9C=88=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FilterPopup/index.tsx | 8 ++++++++ .../Picker/CalendarDialog/DialogCalendarCard.tsx | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/FilterPopup/index.tsx b/src/components/FilterPopup/index.tsx index c795caf..c265e8f 100644 --- a/src/components/FilterPopup/index.tsx +++ b/src/components/FilterPopup/index.tsx @@ -41,7 +41,15 @@ const FilterPopup = (props: FilterPopupProps) => { const handleDateChange = (dates: Date[]) => { console.log(dates,'datesdatesdatesdatesdates'); let times: String[] = []; + if (dates.length > 1) { + times = [dayjs(dates[0]).format('YYYY-MM-DD'), dayjs(dates[dates.length - 1]).format('YYYY-MM-DD')] + onChange({ + 'dateRange': times, + }) + return; + } if (Array.isArray(dates)) { + const currentDay = dayjs(dates[0]).format('YYYY-MM-DD'); if (filterOptions.dateRange.length === 0 || filterOptions.dateRange.length === 2) { times.push(currentDay); diff --git a/src/components/Picker/CalendarDialog/DialogCalendarCard.tsx b/src/components/Picker/CalendarDialog/DialogCalendarCard.tsx index fca255a..1156de6 100644 --- a/src/components/Picker/CalendarDialog/DialogCalendarCard.tsx +++ b/src/components/Picker/CalendarDialog/DialogCalendarCard.tsx @@ -89,7 +89,10 @@ const DialogCalendarCard: React.FC = ({ onClose(); } }; - + const dialogClose = () => { + setType("year"); + onClose(); + } const calculateMonthDifference = (date1, date2) => { if (!(date1 instanceof Date) || !(date2 instanceof Date)) { throw new Error("Both arguments must be Date objects"); @@ -143,7 +146,7 @@ const DialogCalendarCard: React.FC = ({ const month = value[1] as number; setSelected(new Date(year, month - 1, 1)); }; - const dialogClose = () => { + const onCancel = () => { if (type === "month") { setType("year"); } else if (type === "time") { @@ -171,12 +174,13 @@ const DialogCalendarCard: React.FC = ({ } }, [type, pendingJump]); - console.log([selectedHour, selectedMinute], "selectedHour, selectedMinute"); + console.log([selectedHour, selectedMinute], visible,type, "selectedHour, selectedMinute"); return (