dan-s1 commented on code in PR #9367:
URL: https://github.com/apache/nifi/pull/9367#discussion_r1803241381
##########
nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/field/ObjectLocalDateTimeFieldConverter.java:
##########
@@ -82,6 +84,24 @@ public LocalDateTime convertField(final Object field, final
Optional<String> pat
throw new FieldConversionException(LocalDateTime.class, field, name);
}
+ private LocalDateTime parseLocalDateTime(final Object field, final String
name, final String string, final DateTimeFormatter formatter) {
+ final LocalDateTime parsed;
+
+ // Attempt ZonedDateTime parsing before LocalDateTime to handle zone
offsets
+ final TemporalAccessor resolved = formatter.parseBest(string,
ZonedDateTime::from, LocalDateTime::from);
+ if (resolved instanceof ZonedDateTime zonedDateTime) {
+ // Convert Instant to LocalDateTime using system default zone
offset to incorporate adjusted hours and minutes
+ final Instant instant = zonedDateTime.toInstant();
+ parsed = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
Review Comment:
This logic is incorporated on lines 149-151
```suggestion
parsed = ofInstant(instant);
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]