diff --git a/apps/backend/src/main/java/no/nav/data/team/resource/domain/Resource.java b/apps/backend/src/main/java/no/nav/data/team/resource/domain/Resource.java index fed26b889..44c12d2f1 100644 --- a/apps/backend/src/main/java/no/nav/data/team/resource/domain/Resource.java +++ b/apps/backend/src/main/java/no/nav/data/team/resource/domain/Resource.java @@ -19,6 +19,8 @@ import java.time.ZonedDateTime; import java.util.UUID; +import static java.util.Objects.isNull; + @Data @Builder @AllArgsConstructor @@ -90,9 +92,14 @@ public ResourceResponse convertToResponse() { .onLeave(onLeave) .resourceType(resourceType) .startDate(startDate) - .endDate(endDate) + .endDate(shouldHideEndDateIfBeforeNow()) .stale(stale) .links(Links.getFor(this)) .build(); } + + private LocalDate shouldHideEndDateIfBeforeNow() { + if (isNull(this.endDate) || this.endDate.isBefore(LocalDate.now())) return null; + else return this.endDate; + } }