mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-22 17:31:55 +00:00
iOS: show dates in older messages
This commit is contained in:
1 parent
b7fda194c8
commit
c81bb0f15d
2 files changed
+5
-11
No files matched your search
@@ -571,7 +571,11 @@ struct CIMeta: Decodable {
|
||||
|
||||
|
||||
func timestampText(_ date: Date) -> String {
|
||||
date.formatted(date: .omitted, time: .shortened)
|
||||
let now = Calendar.current.dateComponents([.day, .hour], from: .now)
|
||||
let dc = Calendar.current.dateComponents([.day, .hour], from: date)
|
||||
return now.day == dc.day || ((now.day ?? 0) - (dc.day ?? 0) == 1 && (dc.hour ?? 0) >= 18 && (now.hour ?? 0) < 12)
|
||||
? date.formatted(date: .omitted, time: .shortened)
|
||||
: String(date.formatted(date: .numeric, time: .omitted).prefix(5))
|
||||
}
|
||||
|
||||
enum CIStatus: Decodable {
|
||||
|
||||
Reference in new issue
Block a user