Skip to content

Commit

Permalink
ORG-1799: Skjuler nå sluttdatoen på responsen hvis sluttdato ikke er …
Browse files Browse the repository at this point in the history
…før dagens dato.
  • Loading branch information
hamkel committed Jun 21, 2024
1 parent 91afc5e commit 3ee8147
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import java.time.ZonedDateTime;
import java.util.UUID;

import static java.util.Objects.isNull;

@Data
@Builder
@AllArgsConstructor
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 3ee8147

Please sign in to comment.