From 4f0af3d0cbb20d277fbdb40b54137c65bfe91d8f Mon Sep 17 00:00:00 2001 From: cc <98377878+hicccc77@users.noreply.github.com> Date: Thu, 12 Feb 2026 21:48:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A5=E6=9C=9F=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=99=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DateRangePicker.scss | 5 +++-- src/components/DateRangePicker.tsx | 6 +++--- src/components/JumpToDateDialog.scss | 2 +- src/components/JumpToDateDialog.tsx | 3 ++- src/pages/ExportPage.scss | 5 ++--- src/pages/ExportPage.tsx | 10 +++++----- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/components/DateRangePicker.scss b/src/components/DateRangePicker.scss index e51145b..af9602f 100644 --- a/src/components/DateRangePicker.scss +++ b/src/components/DateRangePicker.scss @@ -70,6 +70,7 @@ opacity: 0; transform: translateY(-8px); } + to { opacity: 1; transform: translateY(0); @@ -144,6 +145,7 @@ .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); + grid-template-rows: auto repeat(6, 32px); gap: 2px; } @@ -156,7 +158,6 @@ } .calendar-day { - aspect-ratio: 1; display: flex; align-items: center; justify-content: center; @@ -211,4 +212,4 @@ padding-top: 12px; border-top: 1px solid var(--border-color); } -} +} \ No newline at end of file diff --git a/src/components/DateRangePicker.tsx b/src/components/DateRangePicker.tsx index 78d5b4f..f88cfec 100644 --- a/src/components/DateRangePicker.tsx +++ b/src/components/DateRangePicker.tsx @@ -86,7 +86,7 @@ function DateRangePicker({ startDate, endDate, onStartDateChange, onEndDateChang const handleDateClick = (day: number) => { const dateStr = `${currentMonth.getFullYear()}-${String(currentMonth.getMonth() + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}` - + if (selectingStart) { onStartDateChange(dateStr) if (endDate && dateStr > endDate) { @@ -125,8 +125,8 @@ function DateRangePicker({ startDate, endDate, onStartDateChange, onEndDateChang const isToday = (day: number) => { const today = new Date() return currentMonth.getFullYear() === today.getFullYear() && - currentMonth.getMonth() === today.getMonth() && - day === today.getDate() + currentMonth.getMonth() === today.getMonth() && + day === today.getDate() } const renderCalendar = () => { diff --git a/src/components/JumpToDateDialog.scss b/src/components/JumpToDateDialog.scss index cd20c37..9d14355 100644 --- a/src/components/JumpToDateDialog.scss +++ b/src/components/JumpToDateDialog.scss @@ -117,10 +117,10 @@ .days { display: grid; grid-template-columns: repeat(7, 1fr); + grid-template-rows: repeat(6, 36px); gap: 4px; .day-cell { - aspect-ratio: 1; display: flex; align-items: center; justify-content: center; diff --git a/src/components/JumpToDateDialog.tsx b/src/components/JumpToDateDialog.tsx index 6876069..40a0223 100644 --- a/src/components/JumpToDateDialog.tsx +++ b/src/components/JumpToDateDialog.tsx @@ -15,7 +15,8 @@ const JumpToDateDialog: React.FC = ({ onSelect, currentDate = new Date() }) => { - const [calendarDate, setCalendarDate] = useState(new Date(currentDate)) + const isValidDate = (d: any) => d instanceof Date && !isNaN(d.getTime()) + const [calendarDate, setCalendarDate] = useState(isValidDate(currentDate) ? new Date(currentDate) : new Date()) const [selectedDate, setSelectedDate] = useState(new Date(currentDate)) if (!isOpen) return null diff --git a/src/pages/ExportPage.scss b/src/pages/ExportPage.scss index 81dcf6a..c459be1 100644 --- a/src/pages/ExportPage.scss +++ b/src/pages/ExportPage.scss @@ -830,8 +830,7 @@ padding: 28px 32px; border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); - min-width: 420px; - max-width: 500px; + width: 420px; h3 { font-size: 18px; @@ -977,10 +976,10 @@ .calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); + grid-template-rows: repeat(6, 40px); gap: 4px; .calendar-day { - aspect-ratio: 1; display: flex; align-items: center; justify-content: center; diff --git a/src/pages/ExportPage.tsx b/src/pages/ExportPage.tsx index 92b9d81..b420505 100644 --- a/src/pages/ExportPage.tsx +++ b/src/pages/ExportPage.tsx @@ -1084,7 +1084,7 @@ function ExportPage() { > 开始日期 - {options.dateRange?.start.toLocaleDateString('zh-CN', { + {options.dateRange?.start?.toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' @@ -1098,7 +1098,7 @@ function ExportPage() { > 结束日期 - {options.dateRange?.end.toLocaleDateString('zh-CN', { + {options.dateRange?.end?.toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' @@ -1136,9 +1136,9 @@ function ExportPage() { } const currentDate = new Date(calendarDate.getFullYear(), calendarDate.getMonth(), day) - const isStart = options.dateRange?.start.toDateString() === currentDate.toDateString() - const isEnd = options.dateRange?.end.toDateString() === currentDate.toDateString() - const isInRange = options.dateRange && currentDate >= options.dateRange.start && currentDate <= options.dateRange.end + const isStart = options.dateRange?.start?.toDateString() === currentDate.toDateString() + const isEnd = options.dateRange?.end?.toDateString() === currentDate.toDateString() + const isInRange = options.dateRange?.start && options.dateRange?.end && currentDate >= options.dateRange.start && currentDate <= options.dateRange.end const today = new Date() today.setHours(0, 0, 0, 0) const isFuture = currentDate > today