Showing
1 changed file
with
46 additions
and
0 deletions
| ... | @@ -1107,6 +1107,8 @@ public class swiftApi { | ... | @@ -1107,6 +1107,8 @@ public class swiftApi { |
| 1107 | private var banner_title: String? | 1107 | private var banner_title: String? |
| 1108 | private var coupon_availability: Int? | 1108 | private var coupon_availability: Int? |
| 1109 | private var category_id: String? | 1109 | private var category_id: String? |
| 1110 | + private var start_date: String? | ||
| 1111 | + private var end_date: String? | ||
| 1110 | 1112 | ||
| 1111 | public init() { | 1113 | public init() { |
| 1112 | self.index_url = "" | 1114 | self.index_url = "" |
| ... | @@ -1135,6 +1137,8 @@ public class swiftApi { | ... | @@ -1135,6 +1137,8 @@ public class swiftApi { |
| 1135 | self.banner_title = "" | 1137 | self.banner_title = "" |
| 1136 | self.coupon_availability = nil | 1138 | self.coupon_availability = nil |
| 1137 | self.category_id = "" | 1139 | self.category_id = "" |
| 1140 | + self.start_date = "" | ||
| 1141 | + self.end_date = "" | ||
| 1138 | } | 1142 | } |
| 1139 | 1143 | ||
| 1140 | public init(dictionary: [String: Any]) { | 1144 | public init(dictionary: [String: Any]) { |
| ... | @@ -1152,6 +1156,30 @@ public class swiftApi { | ... | @@ -1152,6 +1156,30 @@ public class swiftApi { |
| 1152 | self.ccms = nil | 1156 | self.ccms = nil |
| 1153 | self.coupon_availability = nil | 1157 | self.coupon_availability = nil |
| 1154 | 1158 | ||
| 1159 | + let startDateString = dictionary["start_date"] as? String? ?? "" | ||
| 1160 | + // Example expirationString: "start_date" = "2022-06-29 00:00:00"; | ||
| 1161 | + let dateFormatter = DateFormatter() | ||
| 1162 | + dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" | ||
| 1163 | + if let date = dateFormatter.date(from: startDateString ?? "") { | ||
| 1164 | + dateFormatter.dateFormat = "dd/MM/yyyy" | ||
| 1165 | + let resultString = dateFormatter.string(from: date) | ||
| 1166 | + self.start_date = resultString | ||
| 1167 | + } else { | ||
| 1168 | + self.start_date = "" | ||
| 1169 | + } | ||
| 1170 | + | ||
| 1171 | + let endDateString = dictionary["end_date"] as? String? ?? "" | ||
| 1172 | + // Example expirationString: "end_date" = "2024-11-30 12:00:00"; | ||
| 1173 | + let dateFormatter2 = DateFormatter() | ||
| 1174 | + dateFormatter2.dateFormat = "yyyy-MM-dd HH:mm:ss" | ||
| 1175 | + if let date = dateFormatter2.date(from: endDateString ?? "") { | ||
| 1176 | + dateFormatter2.dateFormat = "dd/MM/yyyy" | ||
| 1177 | + let resultString = dateFormatter2.string(from: date) | ||
| 1178 | + self.end_date = resultString | ||
| 1179 | + } else { | ||
| 1180 | + self.end_date = "" | ||
| 1181 | + } | ||
| 1182 | + | ||
| 1155 | // let extra_fields = dictionary["extra_fields"] as? [String: Any]? ?? ["":""] | 1183 | // let extra_fields = dictionary["extra_fields"] as? [String: Any]? ?? ["":""] |
| 1156 | if let extra_fields = dictionary["extra_fields"] as? [String: Any] { | 1184 | if let extra_fields = dictionary["extra_fields"] as? [String: Any] { |
| 1157 | self.subcategory = extra_fields["subcategory"] as? String? ?? "" | 1185 | self.subcategory = extra_fields["subcategory"] as? String? ?? "" |
| ... | @@ -1412,6 +1440,24 @@ public class swiftApi { | ... | @@ -1412,6 +1440,24 @@ public class swiftApi { |
| 1412 | self.category_id = newValue | 1440 | self.category_id = newValue |
| 1413 | } | 1441 | } |
| 1414 | } | 1442 | } |
| 1443 | + | ||
| 1444 | + public var _start_date: String? { | ||
| 1445 | + get { // getter | ||
| 1446 | + return self.start_date | ||
| 1447 | + } | ||
| 1448 | + set(newValue) { //setter | ||
| 1449 | + self.start_date = newValue | ||
| 1450 | + } | ||
| 1451 | + } | ||
| 1452 | + | ||
| 1453 | + public var _end_date: String? { | ||
| 1454 | + get { // getter | ||
| 1455 | + return self.end_date | ||
| 1456 | + } | ||
| 1457 | + set(newValue) { //setter | ||
| 1458 | + self.end_date = newValue | ||
| 1459 | + } | ||
| 1460 | + } | ||
| 1415 | } | 1461 | } |
| 1416 | 1462 | ||
| 1417 | public class CampaignDataModel { | 1463 | public class CampaignDataModel { | ... | ... |
-
Please register or login to post a comment