mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
iOS: show dates in older messages
This commit is contained in:
@@ -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