Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
foreign rules: fix datetime parsing for java 11
Browse files Browse the repository at this point in the history
  • Loading branch information
gstoehld committed Mar 28, 2022
1 parent 2fa4eab commit 312ccac
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -87,9 +88,9 @@ private ForeignRule decodeRule(ObjectNode rule, String country, String id)
var foreignRule = new ForeignRule();
String content = new String((byte[]) CmsUtil.decodeCms(rule.get("cms").asText()), StandardCharsets.UTF_8);
foreignRule.setContent(content);
var validUntil = LocalDateTime.ofInstant(Instant.parse(rule.get("validTo").asText()), ZoneId.of("UTC"));
var validUntil = LocalDateTime.parse(rule.get("validTo").asText(), DateTimeFormatter.ISO_OFFSET_DATE_TIME);
foreignRule.setValidUntil(validUntil);
var validFrom = LocalDateTime.ofInstant(Instant.parse(rule.get("validFrom").asText()), ZoneId.of("UTC"));
var validFrom = LocalDateTime.parse(rule.get("validTo").asText(), DateTimeFormatter.ISO_OFFSET_DATE_TIME);
foreignRule.setValidFrom(validFrom);
foreignRule.setVersion(rule.get("version").asText());
foreignRule.setCountry(country);
Expand Down

0 comments on commit 312ccac

Please sign in to comment.