Skip to content

Commit

Permalink
fix(chat/messages): ensure there is only one label for given date
Browse files Browse the repository at this point in the history
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
  • Loading branch information
osmaczko committed Jan 17, 2023
1 parent b242624 commit be8b270
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ui/StatusQ/src/StatusQ/Components/StatusDateGroupLabel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit be8b270

Please sign in to comment.