bengbengbalabalabeng commented on code in PR #954:
URL: https://github.com/apache/fesod/pull/954#discussion_r3643461745
##########
fesod-sheet/src/main/java/org/apache/fesod/sheet/metadata/csv/CsvCell.java:
##########
@@ -164,7 +164,13 @@ protected void setCellValueImpl(Date value) {
if (value == null) {
return;
}
- this.dateValue = LocalDateTime.ofInstant(value.toInstant(),
ZoneId.systemDefault());
+ if (value instanceof java.sql.Date) {
+ this.dateValue = ((java.sql.Date)
value).toLocalDate().atStartOfDay();
+ } else if (value instanceof java.sql.Time) {
+ this.dateValue = ((java.sql.Time)
value).toLocalTime().atDate(java.time.LocalDate.of(1970, 1, 1));
Review Comment:
`LocalDate.of(1970, 1, 1)` is recommended to be extracted as a public
constant, such as `DateUtils.EPOCH` (due to project environment constraints,
the JDK 9+ `LocalDate.EPOCH` cannot be used directly). Using a custom constant
can improve semantic clarity while avoiding repeated object creation.
Similarly: #954
--
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]