Skip to content

Commit

Permalink
Update TemporalAccessorPicker.java: return null if the date is not in…
Browse files Browse the repository at this point in the history
… format
  • Loading branch information
xianghao-wang committed Oct 26, 2022
1 parent 945a540 commit bd8f8c3
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ private static LocalDate getDate(TemporalAccessor temporalAccessor) {

private static LocalDate getLocalDate(TemporalAccessor dateTime) {
// Try to get as much information from the temporal accessor
if (dateTime == null) return null;
LocalDate date = dateTime.query(TemporalQueries.localDate());
if (date != null) {
return date;
Expand Down Expand Up @@ -139,7 +140,7 @@ public LocalDate fromString(String value) {

TemporalAccessor dateTime = getStringConverter().fromString(value);
temporalAccessorValue.set(dateTime);
return getLocalDate(dateTime);
return dateTime == null ? null : getLocalDate(dateTime);
}
}
}

0 comments on commit bd8f8c3

Please sign in to comment.