You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2020/07/23 16:49:10 UTC

[GitHub] [fineract] percyashu commented on a change in pull request #1179: FINERACT-826 Migrate to java.time from Joda API

percyashu commented on a change in pull request #1179:
URL: https://github.com/apache/fineract/pull/1179#discussion_r459588559



##########
File path: fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/JsonParserHelper.java
##########
@@ -469,7 +470,8 @@ public static LocalDateTime convertDateTimeFrom(final String dateTimeAsString, f
         if (StringUtils.isNotBlank(dateTimeAsString)) {
             try {
                 DateTimeFormatter formatter = new DateTimeFormatterBuilder().parseCaseInsensitive().appendPattern(dateTimeFormat)
-                        .toFormatter(clientApplicationLocale);
+                        .parseDefaulting(ChronoField.HOUR_OF_DAY, 0).parseDefaulting(ChronoField.MINUTE_OF_HOUR, 0)
+                        .parseDefaulting(ChronoField.SECOND_OF_MINUTE, 0).toFormatter(clientApplicationLocale);
                 eventLocalDateTime = LocalDateTime.parse(dateTimeAsString, formatter);

Review comment:
       java.time.format.DateTimeParseException is returned when LocalDateTime.parse()  is called on a Date string lacking a time portion like '23 July 2020' (dont know why convertDateTimeFrom is called instead of  convertFrom for such values). Hence added parseDefaulting for time part when it is missing. 
   Will check for other such occurrences.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org