delei commented on code in PR #719:
URL: https://github.com/apache/fesod/pull/719#discussion_r2603132305


##########
fesod/src/main/java/org/apache/fesod/sheet/metadata/data/WriteCellData.java:
##########
@@ -163,7 +164,8 @@ public WriteCellData(Date dateValue) {
             throw new IllegalArgumentException("DateValue can not be null");
         }
         setType(CellDataTypeEnum.DATE);
-        this.dateValue = LocalDateTime.ofInstant(dateValue.toInstant(), 
ZoneId.systemDefault());
+        // Use getTime() which works for both java.util.Date and java.sql.Date
+        this.dateValue = 
LocalDateTime.ofInstant(Instant.ofEpochMilli(dateValue.getTime()), 
ZoneId.systemDefault());

Review Comment:
   Using the `Date#getTime()` incurs a loss of precision, as it only provides 
millisecond accuracy. Furthermore, might we consider supporting 
`java.sql.Timestamp`? I believe the unit test examples could be improved.



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