From 0a204b6754f7a7277ec3edaa5024365b27da5c21 Mon Sep 17 00:00:00 2001 From: Yang Yongquan Date: Sun, 13 Sep 2026 16:18:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=8D=A1=E7=89=87?= =?UTF-8?q?=E6=98=BE=E7=A4=BAbug=E3=80=82=E5=A6=82=E6=9E=9C=E6=9C=89?= =?UTF-8?q?=E8=B7=A8=E5=A4=9A=E5=A4=A9=E7=9A=84=E6=97=A5=E7=A8=8B=EF=BC=8C?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E4=BC=9A=E4=BB=8E=E5=A4=9A=E5=A4=A9=E6=97=A5?= =?UTF-8?q?=E7=A8=8B=E7=9A=84=E5=BC=80=E5=A7=8B=E9=82=A3=E4=B8=80=E5=A4=A9?= =?UTF-8?q?=E5=BC=80=E5=A7=8B=E6=98=BE=E7=A4=BA=EF=BC=8C=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/CardDataService.ets | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/entry/src/main/ets/common/CardDataService.ets b/entry/src/main/ets/common/CardDataService.ets index 7ba003f..0b2f2f7 100644 --- a/entry/src/main/ets/common/CardDataService.ets +++ b/entry/src/main/ets/common/CardDataService.ets @@ -149,6 +149,12 @@ export class CardDataService { const p = (n: number): string => n < 10 ? '0' + n : String(n); outer: for (const key of dayKeys) { + // 日期头文字由分组日期生成(与列表视图一致:第一天就是"今天"), + // 不能用事件的 startTime——跨天日程归组到今天后,日期头仍是开始日会造成"从开始显示"的假象 + const gd = new Date(key); + const dateLabel: string = key === todayKey + ? '今天' + : `${gd.getMonth() + 1}月${gd.getDate()}日`; const list = groups.get(key) as DisplayEvent[]; const allDay = list.filter((e: DisplayEvent): boolean => e.isAllDay || spansDays(e)); // 跨天日程按全天展示 @@ -172,7 +178,7 @@ export class CardDataService { const de = new Date(e.endTime); item.endTime = `${p(de.getHours())}:${p(de.getMinutes())}`; } - item.date = `${d.getMonth() + 1}月${d.getDate()}日`; + item.date = dateLabel; item.showDate = i === 0; // 当天分组第一条 → 卡片上显示日期头 item.calName = e.calName; item.color = e.color;