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
This commit is contained in:
Patryk Osmaczko 2023-01-17 11:53:02 +01:00 committed by osmaczko
parent b242624c47
commit be8b270023
1 changed files with 1 additions and 1 deletions

View File

@ -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();