Showing
2 changed files
with
19 additions
and
1 deletions
... | @@ -102,7 +102,7 @@ extension AnalysisItemViewCell { | ... | @@ -102,7 +102,7 @@ extension AnalysisItemViewCell { |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | - dateLabel.text = item.created ?? "" // expiration | 105 | + dateLabel.text = item.redeemed ?? "" // expiration |
106 | // itemImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache()) | 106 | // itemImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache()) |
107 | // titleLabel.text = couponSetData?.name ?? "" | 107 | // titleLabel.text = couponSetData?.name ?? "" |
108 | 108 | ... | ... |
... | @@ -565,6 +565,7 @@ public class swiftApi { | ... | @@ -565,6 +565,7 @@ public class swiftApi { |
565 | public let category: String? | 565 | public let category: String? |
566 | public let barcode: String? | 566 | public let barcode: String? |
567 | public let status: Int? | 567 | public let status: Int? |
568 | + public let redeemed: String? | ||
568 | public var couponset_data: CouponSetItemModel? | 569 | public var couponset_data: CouponSetItemModel? |
569 | 570 | ||
570 | public init(dictionary: [String: Any]) { | 571 | public init(dictionary: [String: Any]) { |
... | @@ -614,6 +615,23 @@ public class swiftApi { | ... | @@ -614,6 +615,23 @@ public class swiftApi { |
614 | self.created = "" | 615 | self.created = "" |
615 | } | 616 | } |
616 | 617 | ||
618 | + if let changes_dates = dictionary["changes_dates"] as? [String: Any] { | ||
619 | + let redeemedString = changes_dates["redeemed"] as? String? ?? "" | ||
620 | + // Example redeemedString: "2022-11-03 17:08:21.285355"; | ||
621 | + let dateFormatter3 = DateFormatter() | ||
622 | + dateFormatter3.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSSSS" | ||
623 | + if let date = dateFormatter3.date(from: redeemedString ?? "") { | ||
624 | + dateFormatter3.dateFormat = "dd/MM/yyyy" | ||
625 | + let resultString = dateFormatter3.string(from: date) | ||
626 | + self.redeemed = resultString | ||
627 | + } else { | ||
628 | + self.redeemed = "" | ||
629 | + } | ||
630 | + | ||
631 | + } else { | ||
632 | + self.redeemed = "" | ||
633 | + } | ||
634 | + | ||
617 | } | 635 | } |
618 | 636 | ||
619 | 637 | ... | ... |
-
Please register or login to post a comment