From 04bc71e7d3fb99c95c8771acc65549d553209f24 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期四, 09 一月 2025 09:35:12 +0800 Subject: [PATCH] 时间显示错误 --- src/components/chat/hooks/useScrollLoad.ts | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/components/chat/hooks/useScrollLoad.ts b/src/components/chat/hooks/useScrollLoad.ts index 45b2a33..05c4490 100644 --- a/src/components/chat/hooks/useScrollLoad.ts +++ b/src/components/chat/hooks/useScrollLoad.ts @@ -50,7 +50,9 @@ export const formatShowTimeYear = (str: string) => { const date = moment(str); const now = moment(); - const diffDays = now.diff(date, 'days'); + + // 璁$畻鏃ユ湡宸�,浣跨敤clone()閬垮厤淇敼鍘熷鏃堕棿 + const diffDays = now.clone().startOf('day').diff(date.clone().startOf('day'), 'days'); if (diffDays === 0) { return `浠婂ぉ ${date.format('HH:mm:ss')}`; -- Gitblit v1.9.3