Showing
1 changed file
with
46 additions
and
0 deletions
... | @@ -1190,6 +1190,8 @@ public class swiftApi { | ... | @@ -1190,6 +1190,8 @@ public class swiftApi { |
1190 | private var banner_title: String? | 1190 | private var banner_title: String? |
1191 | private var coupon_availability: Int? | 1191 | private var coupon_availability: Int? |
1192 | private var category_id: String? | 1192 | private var category_id: String? |
1193 | + private var start_date: String? | ||
1194 | + private var end_date: String? | ||
1193 | 1195 | ||
1194 | public init() { | 1196 | public init() { |
1195 | self.index_url = "" | 1197 | self.index_url = "" |
... | @@ -1218,6 +1220,8 @@ public class swiftApi { | ... | @@ -1218,6 +1220,8 @@ public class swiftApi { |
1218 | self.banner_title = "" | 1220 | self.banner_title = "" |
1219 | self.coupon_availability = nil | 1221 | self.coupon_availability = nil |
1220 | self.category_id = "" | 1222 | self.category_id = "" |
1223 | + self.start_date = "" | ||
1224 | + self.end_date = "" | ||
1221 | } | 1225 | } |
1222 | 1226 | ||
1223 | public init(dictionary: [String: Any]) { | 1227 | public init(dictionary: [String: Any]) { |
... | @@ -1234,6 +1238,30 @@ public class swiftApi { | ... | @@ -1234,6 +1238,30 @@ public class swiftApi { |
1234 | self.sorting = dictionary["sorting"] as? Int? ?? 0 | 1238 | self.sorting = dictionary["sorting"] as? Int? ?? 0 |
1235 | self.ccms = nil | 1239 | self.ccms = nil |
1236 | self.coupon_availability = nil | 1240 | self.coupon_availability = nil |
1241 | + | ||
1242 | + let startDateString = dictionary["start_date"] as? String? ?? "" | ||
1243 | + // Example expirationString: "start_date" = "2022-06-29 00:00:00"; | ||
1244 | + let dateFormatter = DateFormatter() | ||
1245 | + dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" | ||
1246 | + if let date = dateFormatter.date(from: startDateString ?? "") { | ||
1247 | + dateFormatter.dateFormat = "dd/MM/yyyy" | ||
1248 | + let resultString = dateFormatter.string(from: date) | ||
1249 | + self.start_date = resultString | ||
1250 | + } else { | ||
1251 | + self.start_date = "" | ||
1252 | + } | ||
1253 | + | ||
1254 | + let endDateString = dictionary["end_date"] as? String? ?? "" | ||
1255 | + // Example expirationString: "end_date" = "2024-11-30 12:00:00"; | ||
1256 | + let dateFormatter2 = DateFormatter() | ||
1257 | + dateFormatter2.dateFormat = "yyyy-MM-dd HH:mm:ss" | ||
1258 | + if let date = dateFormatter2.date(from: endDateString ?? "") { | ||
1259 | + dateFormatter2.dateFormat = "dd/MM/yyyy" | ||
1260 | + let resultString = dateFormatter2.string(from: date) | ||
1261 | + self.end_date = resultString | ||
1262 | + } else { | ||
1263 | + self.end_date = "" | ||
1264 | + } | ||
1237 | 1265 | ||
1238 | // let extra_fields = dictionary["extra_fields"] as? [String: Any]? ?? ["":""] | 1266 | // let extra_fields = dictionary["extra_fields"] as? [String: Any]? ?? ["":""] |
1239 | if let extra_fields = dictionary["extra_fields"] as? [String: Any] { | 1267 | if let extra_fields = dictionary["extra_fields"] as? [String: Any] { |
... | @@ -1495,6 +1523,24 @@ public class swiftApi { | ... | @@ -1495,6 +1523,24 @@ public class swiftApi { |
1495 | self.category_id = newValue | 1523 | self.category_id = newValue |
1496 | } | 1524 | } |
1497 | } | 1525 | } |
1526 | + | ||
1527 | + public var _start_date: String? { | ||
1528 | + get { // getter | ||
1529 | + return self.start_date | ||
1530 | + } | ||
1531 | + set(newValue) { //setter | ||
1532 | + self.start_date = newValue | ||
1533 | + } | ||
1534 | + } | ||
1535 | + | ||
1536 | + public var _end_date: String? { | ||
1537 | + get { // getter | ||
1538 | + return self.end_date | ||
1539 | + } | ||
1540 | + set(newValue) { //setter | ||
1541 | + self.end_date = newValue | ||
1542 | + } | ||
1543 | + } | ||
1498 | } | 1544 | } |
1499 | 1545 | ||
1500 | public class CampaignDataModel { | 1546 | public class CampaignDataModel { | ... | ... |
-
Please register or login to post a comment