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 (