From be8b2700239f13f9b1a57971d3d36cb3b821f298 Mon Sep 17 00:00:00 2001 From: Patryk Osmaczko Date: Tue, 17 Jan 2023 11:53:02 +0100 Subject: [PATCH] fix(chat/messages): ensure there is only one label for given date Covers the case, where timestamps are missynchronized: ``` clock: 0 timestamp: 31.12.2022 10:00:00 clock: 1 timestamp: 01.01.2023 23:59:30 clock: 2 timestamp: 01.01.2023 23:59:45 clock: 3 timestamp: 02.01.2023 00:00:05 clock: 4 timestamp: 02.01.2023 00:00:10 clock: 5 timestamp: 01.01.2023 23:59:55 ``` Before, it would result in repeated labels: ``` clock: 0 timestamp: 31.12.2022 10:00:00 LABEL: 1.01.2023 clock: 1 timestamp: 01.01.2023 23:59:30 clock: 2 timestamp: 01.01.2023 23:59:45 LABEL: 2.01.2023 clock: 3 timestamp: 02.01.2023 00:00:05 clock: 4 timestamp: 02.01.2023 00:00:10 LABEL: 1.01.2023 clock: 5 timestamp: 01.01.2023 23:59:55 ``` fixes: #8962 --- ui/StatusQ/src/StatusQ/Components/StatusDateGroupLabel.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/StatusQ/src/StatusQ/Components/StatusDateGroupLabel.qml b/ui/StatusQ/src/StatusQ/Components/StatusDateGroupLabel.qml index 60cbbe4d83..7f3c96c16c 100644 --- a/ui/StatusQ/src/StatusQ/Components/StatusDateGroupLabel.qml +++ b/ui/StatusQ/src/StatusQ/Components/StatusDateGroupLabel.qml @@ -21,7 +21,7 @@ StatusBaseText { const currentMsgDate = new Date(messageTimestamp) const prevMsgDate = new Date(previousMessageTimestamp) - if (prevMsgDate > 0 && currentMsgDate.getDay() === prevMsgDate.getDay()) + if (prevMsgDate > 0 && currentMsgDate.getDay() <= prevMsgDate.getDay()) return "" const now = new Date();