Skip to content

Commit

Permalink
Use zoned date time parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
wsargent committed May 13, 2023
1 parent 9945d1d commit 594d8a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package se.citerus.dddsample.interfaces.booking.web;

import java.time.Instant;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -60,16 +62,16 @@ public Instant getFromDate() {
return fromDate;
}

public void setFromDate(Instant fromDate) {
this.fromDate = fromDate;
public void setFromDate(String fromDate) {
this.fromDate = ZonedDateTime.parse(fromDate).toInstant();
}

public Instant getToDate() {
return toDate;
}

public void setToDate(Instant toDate) {
this.toDate = toDate;
public void setToDate(String toDate) {
this.toDate = ZonedDateTime.parse(toDate).toInstant();
}
}
}
4 changes: 2 additions & 2 deletions src/main/resources/templates/admin/selectItinerary.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
<input type="hidden" th:name="|legs[${legStatus.index}].toUnLocode|" th:value="${leg.to}"/>

<input type="hidden" th:name="|legs[${legStatus.index}].fromDate|"
th:value="${#dates.format(leg.loadTime,'yyyy-MM-dd hh:mm')}"/>
th:value="${#dates.formatISO(leg.loadTime)}"/>
<input type="hidden" th:name="|legs[${legStatus.index}].toDate|"
th:value="${#dates.format(leg.unloadTime,'yyyy-MM-dd hh:mm')}"/>
th:value="${#dates.formatISO(leg.unloadTime)}"/>
<tr>
<td th:text="${leg.voyageNumber}"></td>
<td th:text="${leg.from}"></td>
Expand Down

0 comments on commit 594d8a5

Please sign in to comment.