Timestamps in room list inconsistently use absolute and relative formatting #2679
Labels
A-Room-List
O-Frequent
Affects or can be seen by most users regularly or impacts most users' first experience
S-Minor
Impairs non-critical functionality or suitable workarounds exist
T-Defect
Steps to reproduce
This is very easy to reproduce relatively early in the morning with a medium size account.
Outcome
What did you expect?
Consistently formatted timestamps (always "x hours ago", "yesterday", ... or always "hh:mm", "yesterday", ...)
What happened instead?
Room timestamps mix absolute and relative representation for "recent" events.
In the screenshot, the top three rooms show the absolute time because their latest relevant events were "today" (when I took the screenshot). The three rooms below that show a relative timestamp because their latest relevant events were yesterday but are younger than 24 hours. The remaining rooms show "yesterday", because their latest relevant events were yesterday, and they are older than 24 hours.
Note that "yesterday" is obviously a relative timestamp as well, however, this feels correct and is also what Apple's apps (at least mail and messages) do. (They do "hh:mm", "yesterday", "day of the week", "date".)
Additional context
I asked this in the matrix room which resulted in a brief discussion with @pixlwave and @stefanceriu. From this discussion I take that this is known but unintentional behavior and I was asked to open an issue.
I was bored, so I looked at the code to see if something jumps out at me, and I think I found the source of this behavior. I never wrote any meaningful amount of Swift, though, let alone SwiftUI, so take this with a grain of salt. Also, I don't know if this is all already known, so please ignore this paragraph if it is.
The function
Date.formattedMinimal
is used here to format timestamps for the room list.It delegates all formatting for dates that are "yesterday" to the Foundation framework, which seemingly was intended as a way to localize the string "yesterday". Instead, however, the
Date.RelativeFormatStyle
formats dates as "x hours ago" if they are less than 24 hours ago. In combination with the first branch in that function that forces "hh:mm" formatting for dates from "today" this produces the described behavior.Date formatting is also inconsistent across features in the app.
Date.formattedMinimal
is also used for the reactions, but not for read receipts (I hope I found the right locations).Your phone model
iPhone 13 mini / iPad Pro
Operating system version
iOS/iPadOS 17.4.1
Application version
1.6.2 (102)
Homeserver
Synapse 1.104.0 / Proxy 0.99.15
Will you send logs?
No
The text was updated successfully, but these errors were encountered: