From 8196f908fe8e3dc358e25d97b9894fecc18da373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=8B=A4=E6=B0=91?= Date: Thu, 13 Mar 2025 16:58:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(chat):=20=E6=B7=BB=E5=8A=A0=E8=81=8A?= =?UTF-8?q?=E5=A4=A9=E5=9B=BE=E7=89=87=E9=A2=84=E8=A7=88=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=B9=B6=E4=BC=98=E5=8C=96=E6=B6=88=E6=81=AF=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 ChatItemImageView 组件用于显示聊天中的图片消息 - 添加 ImagePreviewView 组件实现图片预览功能 - 优化聊天项 ChatItemView 的布局和时间显示逻辑 - 在 HosChatView 中集成图片预览功能 -调整 HosConversationVIew 的刷新逻辑 - 优化 MessageHelper 中的消息解析和时间显示相关方法 --- src/main/ets/utils/TimeHelper.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/ets/utils/TimeHelper.ts b/src/main/ets/utils/TimeHelper.ts index b24321d..8ec4e3b 100644 --- a/src/main/ets/utils/TimeHelper.ts +++ b/src/main/ets/utils/TimeHelper.ts @@ -72,4 +72,24 @@ export class TimeHelper { static getMonthDays(year: number, month: number) { return new Date(year, month, 0).getDate() } + + /** + * 是不是同一天 + * @param date1 + * @param date2 + * @returns + */ + static isSameDay(date1: Date | number, date2?: Date | number) { + if (typeof date1 === 'number') { + date1 = new Date(date1); + } + if (!date2) { + date2 = new Date(); + } else if (typeof date2 === 'number') { + date2 = new Date(date2); + } + return date1.getFullYear() === date2.getFullYear() && + date1.getMonth() === date2.getMonth() && + date1.getDate() === date2.getDate(); + } }