Showing
2 changed files
with
21 additions
and
1 deletions
... | @@ -106,7 +106,7 @@ public class MyRewardsOfferCollectionViewCell: UICollectionViewCell { | ... | @@ -106,7 +106,7 @@ public class MyRewardsOfferCollectionViewCell: UICollectionViewCell { |
106 | subtitleLabel.font = UIFont(name: "PingLCG-Regular", size: 14) | 106 | subtitleLabel.font = UIFont(name: "PingLCG-Regular", size: 14) |
107 | subtitleLabel.textColor = UIColor(rgb: 0x00111B) | 107 | subtitleLabel.textColor = UIColor(rgb: 0x00111B) |
108 | 108 | ||
109 | - expirationLabel.text = data._expiration_formatted | 109 | + expirationLabel.text = "έως " + data.formattedExpiration(format: "dd-MM") |
110 | expirationLabel.font = UIFont(name: "PingLCG-Regular", size: 13) | 110 | expirationLabel.font = UIFont(name: "PingLCG-Regular", size: 13) |
111 | expirationLabel.textColor = UIColor(rgb: 0x00111B) | 111 | expirationLabel.textColor = UIColor(rgb: 0x00111B) |
112 | 112 | ... | ... |
... | @@ -252,6 +252,26 @@ public class CouponSetItemModel { | ... | @@ -252,6 +252,26 @@ public class CouponSetItemModel { |
252 | 252 | ||
253 | return "" | 253 | return "" |
254 | } | 254 | } |
255 | + | ||
256 | + /// Format expiration date with custom format | ||
257 | + /// - Parameter format: DateFormatter format string (e.g., "dd-MM", "dd/MM/yyyy") | ||
258 | + /// - Returns: Formatted date string or empty string if invalid | ||
259 | + public func formattedExpiration(format: String) -> String { | ||
260 | + guard let expiration = self.expiration, !expiration.isEmpty else { | ||
261 | + return "" | ||
262 | + } | ||
263 | + | ||
264 | + let inputFormatter = DateFormatter() | ||
265 | + inputFormatter.dateFormat = "yyyy-MM-dd HH:mm" | ||
266 | + | ||
267 | + if let date = inputFormatter.date(from: expiration) { | ||
268 | + let outputFormatter = DateFormatter() | ||
269 | + outputFormatter.dateFormat = format | ||
270 | + return outputFormatter.string(from: date) | ||
271 | + } | ||
272 | + | ||
273 | + return "" | ||
274 | + } | ||
255 | } | 275 | } |
256 | 276 | ||
257 | public class RedeemedMerchantDetailsModel: Codable { | 277 | public class RedeemedMerchantDetailsModel: Codable { | ... | ... |
-
Please register or login to post a comment