leehaut opened a new pull request, #1032:
URL: https://github.com/apache/fesod/pull/1032

   ## Purpose of the pull request
   
   Related: #1017
   
   Add first-class converter support for `java.time.LocalTime`, following the 
existing `LocalDate` / `LocalDateTime` pattern.
   
   ## What's changed?
   
   Excel has no native time-only cell type. This PR treats `LocalTime` as the 
time-of-day counterpart of `LocalDate`:
   
   - Writing preserves the wall-clock time, attaches `DateUtils.EPOCH` 
(`1970-01-01`) as the date component, and applies `HH:mm:ss` so Excel shows 
time only.
   - Reading drops any date component with `toLocalTime()`. An Excel-native 
fraction (`0.5` = `12:00:00`) and a full datetime serial that happens to be 
`12:00:00` both become `LocalTime.of(12, 0, 0)`.
   
   Converter family under `org.apache.fesod.sheet.converters.localtime`:
   
   - `LocalTimeDateConverter` — default write path (`DATE` cell, format 
`HH:mm:ss`)
   - `LocalTimeNumberConverter` — bidirectional Excel numeric serial, including 
`use1904windowing`
   - `LocalTimeStringConverter` — bidirectional `STRING` cell; default 
`HH:mm:ss`, also auto-detects `HH:mm`, respects `@DateTimeFormat` and `Locale`
   
   `DateUtils` additions (mirroring `parseLocalDate` / `format(LocalDate)`):
   
   - `DEFAULT_LOCAL_TIME_FORMAT` / `TIME_FORMAT_8` / `TIME_FORMAT_5`
   - `parseLocalTime(...)` / `format(LocalTime, ...)` / `switchTimeFormat(...)` 
/ `getLocalTime(...)`
   
   Registration in `DefaultConverterLoader` matches `LocalDateTime`:
   
   - Number and String converters in `initAllConverter()`
   - Date converter as the default write converter
   - String converter for string-formatted writes
   
   Scope is limited to `java.time.LocalTime` (JDK 8). Converter lookup is keyed 
by the declared Java class, so existing `Date` converters do not cover 
`LocalTime` fields.


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