Manos Chorianopoulos

fix unified coupon expiration date

......@@ -176,8 +176,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 = ""
}
......
......@@ -65,8 +65,9 @@ import UIKit
activeCouponsCount == 1 ? "έχεις " + String(activeCouponsCount) + " ενεργό κουπόνι"
: "έχεις " + String(activeCouponsCount) + " ενεργά κουπόνια"
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 = ""
}
......