Manos Chorianopoulos

update CouponItemModel

......@@ -408,6 +408,7 @@ public class swiftApi {
public let name: String?
public let image: String?
public let expiration: String?
public let created: String?
public let description: String?
public let discount: String?
public let coupon: String?
......@@ -438,11 +439,12 @@ 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()
dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss"
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
if let date = dateFormatter.date(from: expirationString ?? "") {
dateFormatter.dateFormat = "dd/MM/yyyy"
let resultString = dateFormatter.string(from: date)
......@@ -450,6 +452,14 @@ public class swiftApi {
} else {
self.expiration = ""
}
if let date = dateFormatter.date(from: createdString ?? "") {
dateFormatter.dateFormat = "dd/MM/yyyy"
let resultString = dateFormatter.string(from: date)
self.created = resultString
} else {
self.created = ""
}
}
......