Manos Chorianopoulos

fix unified coupon expiration date

......@@ -196,8 +196,9 @@ import AVFoundation
showBarcodeButtonTopSpace.constant = 0
// ===
if let earliestExpiration = coupon?._coupons.min(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) {
expirationLabel.text = "Το κουπόνι ισχύει έως " + (earliestExpiration.expiration ?? "")
// if let earliestExpiration = coupon?._coupons.min(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) {
if let latestExpiration = coupon?._coupons.max(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) {
expirationLabel.text = "Το κουπόνι ισχύει έως " + (latestExpiration.expiration ?? "")
} else {
expirationLabel.text = ""
}
......
......@@ -69,8 +69,9 @@ import UIKit
)
// + " αξίας " + String(activeCouponsDiscount) + "€"
if let earliestExpiration = activeCoupons.min(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) {
expirationLabel.text = "Ισχύει έως " + (earliestExpiration.expiration ?? "")
// if let earliestExpiration = activeCoupons.min(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) {
if let latestExpiration = activeCoupons.max(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) {
expirationLabel.text = "Ισχύει έως " + (latestExpiration.expiration ?? "")
} else {
expirationLabel.text = ""
}
......