divijvaidya commented on code in PR #18611:
URL: https://github.com/apache/kafka/pull/18611#discussion_r1922774801


##########
connect/api/src/test/java/org/apache/kafka/connect/data/ValuesTest.java:
##########
@@ -901,8 +902,12 @@ public void shouldConvertDateValues() {
         assertEquals(currentDate, d2);
 
         // ISO8601 strings - accept a string matching pattern "yyyy-MM-dd"
+        // Values.convertToDate convert the "yyyy-MM-dd" string will miss the 
time and timezone information, 
+        // so we need to adjust the date from the current timezone to UTC0
+        TimeZone tz = TimeZone.getDefault();
+        java.util.Date currentDate3 = new java.util.Date(current.getTime() - 
currentMillis - tz.getOffset(current.getTime()));
         java.util.Date d3 = Values.convertToDate(Date.SCHEMA, 
LocalDate.ofEpochDay(days).format(DateTimeFormatter.ISO_LOCAL_DATE));
-        assertEquals(currentDate, d3);

Review Comment:
   I must be missing something here so please help me understand the following:
   
   Java's util.Date is timezone agnostic (it's always epochs in UTC timezone) 
until you want to print it (where you can format it). Hence, the currentDate 
here should already be in UTC timezone. And the actual value from 
`LocalDate.ofEpochDay(days).format(DateTimeFormatter.ISO_LOCAL_DATE)` should 
also be in UTC. So, where is the disconnect here? 



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to