mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Fixed a bug where conversations without messages could display invalid dates
This commit is contained in:
parent
ef5aa927a0
commit
382b466ded
|
@ -5,6 +5,9 @@ import SessionUtilitiesKit
|
||||||
|
|
||||||
public extension Date {
|
public extension Date {
|
||||||
var formattedForDisplay: String {
|
var formattedForDisplay: String {
|
||||||
|
// If we don't have a date then
|
||||||
|
guard self.timeIntervalSince1970 > 0 else { return "" }
|
||||||
|
|
||||||
let dateNow: Date = Date()
|
let dateNow: Date = Date()
|
||||||
|
|
||||||
guard Calendar.current.isDate(self, equalTo: dateNow, toGranularity: .year) else {
|
guard Calendar.current.isDate(self, equalTo: dateNow, toGranularity: .year) else {
|
||||||
|
|
Loading…
Reference in a new issue