Skip to content

Commit

Permalink
Fix Date format when T present
Browse files Browse the repository at this point in the history
  • Loading branch information
arybakov-cgi committed Jul 25, 2023
1 parent b31a98e commit 7b50871
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ public LocalDateTime deserialize(JsonParser jsonParser, DeserializationContext d
formatter = DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT);
return LocalDateTime.parse(dateAsString, formatter);
} else if(StringUtils.isNotBlank(dateAsString) && dateAsString.length() > 19 && dateAsString.contains("/") && dateAsString.contains("T")) {
formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss.000+00:00");
return LocalDateTime.parse(StringUtils.replace(dateAsString, "T", " "), formatter);
formatter = DateTimeFormatter.ofPattern(SECOND_DEFAULT_DATE_TIME_FORMAT);
return LocalDateTime.parse(StringUtils.replace(StringUtils.substringBefore(dateAsString, "."), "T", " "), formatter);
} else if(StringUtils.isNotBlank(dateAsString) && dateAsString.length() > 19 && dateAsString.contains("-") && dateAsString.contains("T")) {
formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.000+00:00");
return LocalDateTime.parse(StringUtils.replace(dateAsString, "T", " "), formatter);
formatter = DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT);
return LocalDateTime.parse(StringUtils.replace(StringUtils.substringBefore(dateAsString, "."), "T", " "), formatter);
} else if(StringUtils.isNotBlank(dateAsString)) {
return LocalDateTime.parse(dateAsString, formatter);
}
Expand Down

0 comments on commit 7b50871

Please sign in to comment.