TF-2464 Sort list new emails push notification by receivedAt
Signed-off-by: dab246 <tdvu@linagora.com> (cherry picked from commit 44a1f4a44c9bc5612cef610334ce01dbaff9e051)
This commit is contained in:
@@ -9,4 +9,24 @@ extension String {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func convertUTCDateToLocalDate() -> Date? {
|
||||
let dateFormatter = DateFormatter()
|
||||
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'"
|
||||
dateFormatter.timeZone = TimeZone(identifier: "UTC")
|
||||
|
||||
if let utcDate = dateFormatter.date(from: self) {
|
||||
TwakeLogger.shared.log(message: "UTC Date: \(utcDate)")
|
||||
dateFormatter.timeZone = TimeZone.current
|
||||
let localDateString = dateFormatter.string(from: utcDate)
|
||||
TwakeLogger.shared.log(message: "Local Date: \(localDateString)")
|
||||
if let localDate = dateFormatter.date(from: localDateString) {
|
||||
return localDate
|
||||
}
|
||||
return nil
|
||||
} else {
|
||||
TwakeLogger.shared.log(message: "Error converting UTC date string to Date.")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user