fix(LOY-175): fix issues of getting correct expiration date on reward coupon
This commit is contained in:
@@ -14,7 +14,6 @@ import type {
|
||||
} from "@/types/components/myPages/rewards"
|
||||
import type {
|
||||
ApiReward,
|
||||
Coupon,
|
||||
RedeemableCoupon,
|
||||
RedeemLocation,
|
||||
} from "@/server/routers/contentstack/reward/output"
|
||||
@@ -82,8 +81,8 @@ function getFirstRedeemableCoupon(reward: ApiReward): RedeemableCoupon {
|
||||
return sortedCoupons[0]
|
||||
}
|
||||
|
||||
function getEarliestExpirationDate(coupons: Coupon[]) {
|
||||
return coupons
|
||||
function getEarliestExpirationDate(reward: ApiReward) {
|
||||
return getReedemableCoupons(reward)
|
||||
.map(({ expiresAt }) => expiresAt)
|
||||
.filter((expiresAt): expiresAt is string => !!expiresAt)
|
||||
.reduce((earliestDate: Dayjs | null, expiresAt) => {
|
||||
|
||||
Reference in New Issue
Block a user