From 104c5e5baa70e5c530801f8e5b037b6b16c11d2b Mon Sep 17 00:00:00 2001 From: meyou <2636699780@qq.com> Date: Sat, 16 May 2026 13:10:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8A=98=E5=8F=A0=E6=80=81?= =?UTF-8?q?=E8=B7=A8=E6=9C=88=E5=91=A8=E9=80=89=E4=B8=AD=E4=B8=8A=E4=B8=AA?= =?UTF-8?q?=E6=9C=88=E6=97=A5=E6=9C=9F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 跨月周(如5月第一周周一是4月27日)改为选中下个月的1号, 避免月份标题和展开内容不一致。 --- .../kotlin/plus/rua/project/ui/CalendarMonthView.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 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 d805129..433b56f 100644 --- a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt +++ b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt @@ -179,9 +179,16 @@ fun CalendarMonthView( today = today, onDateClick = { date -> viewModel.selectDate(date) }, onWeekChanged = { weekMonday -> - // 优先选中当周内的今天,否则选中该周周一 val weekSunday = weekMonday.plus(DatePeriod(days = 6)) - val date = if (today in weekMonday..weekSunday) today else weekMonday + val date = when { + today in weekMonday..weekSunday -> today + weekMonday.month != weekSunday.month -> { + // 跨月周:选中下个月的1号 + @Suppress("DEPRECATION") // monthNumber 无替代 API + LocalDate(weekSunday.year, weekSunday.month.number, 1) + } + else -> weekMonday + } viewModel.selectDate(date) }, modifier = pagerModifier