From dd35d16b0c38d8c9831e98231dd47be232ddc385 Mon Sep 17 00:00:00 2001 From: Aleix Date: Fri, 20 Sep 2024 17:09:03 +0200 Subject: [PATCH] fix: Consider hours as possible max and relateiveMax values (#2155) --- catalog/ui/src/app/api.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/catalog/ui/src/app/api.ts b/catalog/ui/src/app/api.ts index eda2cf2ec..b9f769397 100644 --- a/catalog/ui/src/app/api.ts +++ b/catalog/ui/src/app/api.ts @@ -1313,7 +1313,7 @@ export async function setLifespanEndForResourceClaim( let updatedRelativeMaxDate: string = null; if (resourceClaim.status?.lifespan?.maximum) { const maxDate = new Date(resourceClaim.metadata.creationTimestamp); - maxDate.setDate(maxDate.getDate() + parseInt(resourceClaim.status.lifespan.maximum.slice(0, -1), 10)); + maxDate.setTime(maxDate.getTime() + parseDuration(resourceClaim.status.lifespan.maximum)); if (date.getTime() > maxDate.getTime()) { updatedMaxDate = Math.ceil( @@ -1325,7 +1325,7 @@ export async function setLifespanEndForResourceClaim( } if (resourceClaim.status?.lifespan?.relativeMaximum) { const maxDate = new Date(); - maxDate.setDate(maxDate.getDate() + parseInt(resourceClaim.status.lifespan.relativeMaximum.slice(0, -1), 10)); + maxDate.setTime(maxDate.getTime() + parseDuration(resourceClaim.status.lifespan.relativeMaximum)); if (date.getTime() > maxDate.getTime()) { updatedRelativeMaxDate = Math.ceil((date.getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24)) + 1 + 'd'; }