File tree Expand file tree Collapse file tree
memex/src/main/java/com/johnlpage/memex/util Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,16 +30,15 @@ public static Object convertObject(Object input) {
3030 return ((Number ) input ).doubleValue ();
3131 }
3232 if (input instanceof String str ) {
33- if (! str . isEmpty () && str .length () >= 8 && Character .isDigit (str .charAt (0 ))) {
33+ if (str .length () >= 8 && Character .isDigit (str .charAt (0 ))) {
3434 for (DateTimeFormatter formatter : DATE_FORMATTERS ) {
3535 try {
3636 // Try parsing as different date/time types
3737 if (str .contains ("T" )) {
38- if (str .contains ("Z" ) || str .contains ( "+" ) || str . contains ( "- " )) {
38+ if (str .endsWith ("Z" ) || str .matches ( ".*[+-] \\ d{2}(: \\ d{2})?$ " )) {
3939 return ZonedDateTime .parse (str , formatter ).toInstant ();
4040 } else {
41- return LocalDateTime .parse (str , formatter )
42- .toInstant (ZoneOffset .UTC );
41+ return LocalDateTime .parse (str , formatter ).toInstant (ZoneOffset .UTC );
4342 }
4443 } else {
4544 return LocalDate .parse (str , formatter );
You can’t perform that action at this time.
0 commit comments