Manos Chorianopoulos

fix CouponItemModel

......@@ -439,8 +439,6 @@ public class swiftApi {
let expirationString = dictionary["expiration"] as? String? ?? ""
let createdString = dictionary["created"] as? String? ?? ""
// Example expirationString: Optional(2022-12-05 01:55)
let dateFormatter = DateFormatter()
......@@ -453,15 +451,19 @@ public class swiftApi {
self.expiration = ""
}
if let date = dateFormatter.date(from: createdString ?? "") {
dateFormatter.dateFormat = "dd/MM/yyyy"
let resultString = dateFormatter.string(from: date)
let createdString = dictionary["created"] as? String? ?? ""
// Example createdString: Optional("2022-08-26 15:20:22.287097")
let dateFormatter2 = DateFormatter()
dateFormatter2.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSSSS"
if let date = dateFormatter2.date(from: createdString ?? "") {
dateFormatter2.dateFormat = "dd/MM/yyyy"
let resultString = dateFormatter2.string(from: date)
self.created = resultString
} else {
self.created = ""
}
}
......