bamaer commented on code in PR #9519:
URL: https://github.com/apache/hop/pull/9519#discussion_r4595853569
##########
plugins/transforms/yamlinput/src/main/java/org/apache/hop/pipeline/transforms/yamlinput/YamlReader.java:
##########
@@ -467,6 +471,39 @@ private static String stripTrailingLineBreaks(String s) {
return s.substring(0, end);
}
+ /**
+ * object -> date. SnakeYAML reads an unquoted ISO date as a {@link
java.util.Date}; a quoted one,
+ * or another format, stays text and is parsed with the field's format, so
the value matches the
+ * Date type the field declares.
+ */
+ private Object convertToDate(Object value, IValueMeta valueMeta) {
+ if (value instanceof java.util.Date) {
+ return value;
+ }
+ return convertText(value, valueMeta);
+ }
Review Comment:
Minor: quoted dates are parsed in the JVM time zone, unquoted ones come from
SnakeYAML as UTC midnight. With format `yyyy-MM-dd`, `2020-02-28` gives
2020-02-28T00:00Z, while `'2020-02-28'` gives 2020-02-27T23:00Z in
Europe/Brussels and 2020-02-28T05:00Z in America/New_York. Surefire pins UTC,
so the unit test can't see this. Fine if intended, since it matches how Hop
parses text elsewhere.
--
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]