From a5523258572d1812e8e7a9eac43544cc1df58fa9 Mon Sep 17 00:00:00 2001 From: Sachin Date: Tue, 16 Apr 2024 13:24:19 +0545 Subject: [PATCH 1/2] fix:fixed chat date separator issue on day's first message --- .../Conversation/components/Conversations.tsx | 67 +++++++++++-------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/packages/screens/Mini/Conversation/components/Conversations.tsx b/packages/screens/Mini/Conversation/components/Conversations.tsx index 14185a5991..12351e3049 100644 --- a/packages/screens/Mini/Conversation/components/Conversations.tsx +++ b/packages/screens/Mini/Conversation/components/Conversations.tsx @@ -121,6 +121,35 @@ export const Conversations = ({ ); } + const renderDateSeparator = (separatorDate: string) => { + return ( + + + + {moment(separatorDate).format("YYYY, MMM DD")} + + + ); + }; + return ( <> - {!!separatorDate && ( - - - - {moment(separatorDate).format("YYYY, MMM DD")} - - - )} + {!!separatorDate && + !previousMessage && + renderDateSeparator(separatorDate)} {item.type === "accept-contact" && !previousMessage && ( )} + {!!separatorDate && + previousMessage && + renderDateSeparator(separatorDate)} ); }} From 9a33f0cd7cbdda626e1cbbe86a1a0385014c5346 Mon Sep 17 00:00:00 2001 From: Sachin Date: Tue, 16 Apr 2024 16:25:34 +0545 Subject: [PATCH 2/2] fix: on chat date grouping with locale date format --- .../screens/Mini/Conversation/components/Conversations.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/screens/Mini/Conversation/components/Conversations.tsx b/packages/screens/Mini/Conversation/components/Conversations.tsx index 12351e3049..e57736a203 100644 --- a/packages/screens/Mini/Conversation/components/Conversations.tsx +++ b/packages/screens/Mini/Conversation/components/Conversations.tsx @@ -144,7 +144,7 @@ export const Conversations = ({ }, ]} > - {moment(separatorDate).format("YYYY, MMM DD")} + {moment(separatorDate).format("L")} ); @@ -167,8 +167,8 @@ export const Conversations = ({ index < messages.length - 1 ? messages[index + 1] : undefined; const separatorDate = previousMessage - ? moment(item.timestamp).format("DD/MM/YYYY") === - moment(previousMessage.timestamp).format("DD/MM/YYYY") + ? moment(item.timestamp).format("L") === + moment(previousMessage.timestamp).format("L") ? false : item?.timestamp : item.timestamp;