exceptionfactory commented on PR #9379:
URL: https://github.com/apache/nifi/pull/9379#issuecomment-2414744976
> @exceptionfactory With that change should we should also then improve what
is returned by ExcelRecordReader on line 146. Currently we return a
`java.util.Date` with `cell.getDateCellValue()` but I think we should employ
similar logic to determine if its a DATE/TIME then call
`cell.getLocalDateTimeCellValue()` to return a `java.time.LocalDateTime`.
>
> e.g.
>
> ```
> case NUMERIC -> {
> if (DateUtil.isCellDateFormatted(cell)) {
> final double numericCellValue =
cell.getNumericCellValue();
> final long roundedCellValue = (long)
numericCellValue;
> if ((numericCellValue > 0 && numericCellValue < 1)
|| (roundedCellValue == numericCellValue)) {
> yield cell.getLocalDateTimeCellValue();
> } else {
> yield cell.getDateCellValue();
> }
> } else {
> yield cell.getNumericCellValue();
> }
> }
> ```
The `java.util.Date` includes both Date and Time, so that is why it is
functionally equivalent to the return value of `getLocalDateTimeCellValue()` in
this scenario.
--
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]