From 09e13e335c7f33cd3e74fbc382efed65069e82fa Mon Sep 17 00:00:00 2001 From: meyou <2636699780@qq.com> Date: Sat, 16 May 2026 13:28:29 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20=E8=B7=A8=E6=9C=88=E5=91=A8=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E9=80=BB=E8=BE=91=E7=9A=84=E4=B8=A4=E4=B8=AA=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=EF=BC=8C=E9=87=8D=E6=96=B0=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plus/rua/project/ui/CalendarMonthView.kt | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt index c697854..d805129 100644 --- a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt +++ b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt @@ -179,21 +179,9 @@ fun CalendarMonthView( today = today, onDateClick = { date -> viewModel.selectDate(date) }, onWeekChanged = { weekMonday -> + // 优先选中当周内的今天,否则选中该周周一 val weekSunday = weekMonday.plus(DatePeriod(days = 6)) - val date = when { - today in weekMonday..weekSunday -> today - weekMonday.month != weekSunday.month -> { - if (weekMonday < viewModel.selectedDate) { - // 后退到跨月周(如从5月回到4月27-5月3):选较晚月份1号 - @Suppress("DEPRECATION") // monthNumber 无替代 API - LocalDate(weekSunday.year, weekSunday.month.number, 1) - } else { - // 前进到跨月周(如从4月前进到4月27-5月3):选该周周一 - weekMonday - } - } - else -> weekMonday - } + val date = if (today in weekMonday..weekSunday) today else weekMonday viewModel.selectDate(date) }, modifier = pagerModifier