skytin1004 commented on code in PR #912:
URL: https://github.com/apache/fesod/pull/912#discussion_r3273554579


##########
fesod-sheet/src/main/java/org/apache/fesod/sheet/metadata/data/WriteCellData.java:
##########
@@ -169,7 +170,11 @@ public WriteCellData(Date dateValue) {
             throw new IllegalArgumentException("DateValue can not be null");
         }
         setType(CellDataTypeEnum.DATE);
-        this.dateValue = LocalDateTime.ofInstant(dateValue.toInstant(), 
ZoneId.systemDefault());
+        if (dateValue instanceof java.sql.Date || dateValue instanceof 
java.sql.Time) {
+            this.dateValue = 
LocalDateTime.ofInstant(Instant.ofEpochMilli(dateValue.getTime()), 
ZoneId.systemDefault());
+        } else {
+            this.dateValue = LocalDateTime.ofInstant(dateValue.toInstant(), 
ZoneId.systemDefault());
+        }

Review Comment:
   @alaahong Good point. I changed this path to use SQL Date/Time APIs directly 
instead of going through epoch millis.
   
   java.sql.Date now uses toLocalDate(), and java.sql.Time uses toLocalTime(). 
The existing toInstant() path is still kept for java.util.Date and 
java.sql.Timestamp.
   
   I also checked the other date conversions. Some existing generic 
Date/Calendar paths still use the system default timezone, but they are not 
introduced by this PR. I will look at those separately and follow up if we want 
to make them consistent.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to