Manos Chorianopoulos

fix history cell redeemed date

......@@ -102,7 +102,7 @@ extension AnalysisItemViewCell {
}
}
dateLabel.text = item.created ?? "" // expiration
dateLabel.text = item.redeemed ?? "" // expiration
// itemImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache())
// titleLabel.text = couponSetData?.name ?? ""
......
......@@ -565,6 +565,7 @@ public class swiftApi {
public let category: String?
public let barcode: String?
public let status: Int?
public let redeemed: String?
public var couponset_data: CouponSetItemModel?
public init(dictionary: [String: Any]) {
......@@ -614,6 +615,23 @@ public class swiftApi {
self.created = ""
}
if let changes_dates = dictionary["changes_dates"] as? [String: Any] {
let redeemedString = changes_dates["redeemed"] as? String? ?? ""
// Example redeemedString: "2022-11-03 17:08:21.285355";
let dateFormatter3 = DateFormatter()
dateFormatter3.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSSSS"
if let date = dateFormatter3.date(from: redeemedString ?? "") {
dateFormatter3.dateFormat = "dd/MM/yyyy"
let resultString = dateFormatter3.string(from: date)
self.redeemed = resultString
} else {
self.redeemed = ""
}
} else {
self.redeemed = ""
}
}
......