From a5523258572d1812e8e7a9eac43544cc1df58fa9 Mon Sep 17 00:00:00 2001 From: Sachin Date: Tue, 16 Apr 2024 13:24:19 +0545 Subject: [PATCH] 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)} ); }}