From 857cf88cb0ec1ad78fe2847fded4676b445e7c9f Mon Sep 17 00:00:00 2001 From: meyou <2636699780@qq.com> Date: Sat, 16 May 2026 13:22:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B7=A8=E6=9C=88=E5=91=A8?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E9=80=BB=E8=BE=91=EF=BC=9A=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E6=BB=91=E5=8A=A8=E6=96=B9=E5=90=91=E5=86=B3=E5=AE=9A=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E6=97=A5=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 后退到跨月周(如从5月滑到4月27-5月3):选中较晚月份1号,留在当月。 前进到跨月周(如从4月滑到4月27-5月3):选中该周周一,留在上个月。 --- .../kotlin/plus/rua/project/ui/CalendarMonthView.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 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 433b56f..c697854 100644 --- a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt +++ b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt @@ -183,9 +183,14 @@ fun CalendarMonthView( val date = when { today in weekMonday..weekSunday -> today weekMonday.month != weekSunday.month -> { - // 跨月周:选中下个月的1号 - @Suppress("DEPRECATION") // monthNumber 无替代 API - LocalDate(weekSunday.year, weekSunday.month.number, 1) + 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 }