Manos Chorianopoulos

update CouponItemModel

...@@ -408,6 +408,7 @@ public class swiftApi { ...@@ -408,6 +408,7 @@ public class swiftApi {
408 public let name: String? 408 public let name: String?
409 public let image: String? 409 public let image: String?
410 public let expiration: String? 410 public let expiration: String?
411 + public let created: String?
411 public let description: String? 412 public let description: String?
412 public let discount: String? 413 public let discount: String?
413 public let coupon: String? 414 public let coupon: String?
...@@ -438,11 +439,12 @@ public class swiftApi { ...@@ -438,11 +439,12 @@ public class swiftApi {
438 439
439 440
440 let expirationString = dictionary["expiration"] as? String? ?? "" 441 let expirationString = dictionary["expiration"] as? String? ?? ""
442 + let createdString = dictionary["created"] as? String? ?? ""
441 443
442 // Example expirationString: Optional(2022-12-05 01:55) 444 // Example expirationString: Optional(2022-12-05 01:55)
443 445
444 let dateFormatter = DateFormatter() 446 let dateFormatter = DateFormatter()
445 - dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss" 447 + dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
446 if let date = dateFormatter.date(from: expirationString ?? "") { 448 if let date = dateFormatter.date(from: expirationString ?? "") {
447 dateFormatter.dateFormat = "dd/MM/yyyy" 449 dateFormatter.dateFormat = "dd/MM/yyyy"
448 let resultString = dateFormatter.string(from: date) 450 let resultString = dateFormatter.string(from: date)
...@@ -450,6 +452,14 @@ public class swiftApi { ...@@ -450,6 +452,14 @@ public class swiftApi {
450 } else { 452 } else {
451 self.expiration = "" 453 self.expiration = ""
452 } 454 }
455 +
456 + if let date = dateFormatter.date(from: createdString ?? "") {
457 + dateFormatter.dateFormat = "dd/MM/yyyy"
458 + let resultString = dateFormatter.string(from: date)
459 + self.created = resultString
460 + } else {
461 + self.created = ""
462 + }
453 463
454 464
455 } 465 }
......