treat validUntil as Date in case of DisbursementLink too

This commit is contained in:
clauspeterhuebner 2025-04-24 14:34:26 +02:00
parent f133cb15bc
commit 322e4ca37f
2 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
import { Decimal } from 'decimal.js-light'
import { ObjectType, Field, Int } from 'type-graphql'
import { ObjectType, Field } from 'type-graphql'
import { DisbursementJwtPayloadType } from '@/auth/jwt/payloadtypes/DisbursementJwtPayloadType'
@ -27,7 +27,7 @@ export class DisbursementLink {
this.memo = disbursementPayload.memo
this.code = disbursementPayload.redeemcode
if (disbursementPayload.exp) {
this.validUntil = disbursementPayload.exp * 1000
this.validUntil = new Date(disbursementPayload.exp * 1000)
}
}
@ -52,6 +52,6 @@ export class DisbursementLink {
@Field(() => String)
code: string
@Field(() => Int)
validUntil: number
@Field(() => Date)
validUntil: Date
}

View File

@ -104,8 +104,8 @@ const tokenExpiresInSeconds = computed(() => {
const validLink = computed(() => {
console.log('TransactionLink.validLink... linkData.value.validUntil=', linkData.value.validUntil)
console.log('TransactionLink.validLink... new Date().getTime()=', new Date().getTime())
return new Date(linkData.value.validUntil) > new Date()
console.log('TransactionLink.validLink... new Date()=', new Date())
return linkData.value.validUntil > new Date()
})
const itemType = computed(() => {
@ -113,7 +113,7 @@ const itemType = computed(() => {
console.log('TransactionLink.itemType... TEXT_DELETED')
return 'TEXT_DELETED'
}
if (new Date(linkData.value.validUntil) < new Date()) {
if (linkData.value.validUntil < new Date()) {
console.log('TransactionLink.itemType... TEXT_EXPIRED')
return 'TEXT_EXPIRED'
}
@ -165,7 +165,7 @@ function updateRedeemedBoxText(type) {
break
case 'TEXT_EXPIRED':
redeemedBoxText.value = t('gdd_per_link.link-expired', {
date: d(new Date(linkData.value.validUntil), 'long'),
date: d(linkData.value.validUntil, 'long'),
})
break
case 'TEXT_REDEEMED':