Skip to content

Commit

Permalink
fix: Consider hours as possible max and relateiveMax values (#2155)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleixhub authored Sep 20, 2024
1 parent 8c943d0 commit dd35d16
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions catalog/ui/src/app/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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';
}
Expand Down

0 comments on commit dd35d16

Please sign in to comment.