You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fesod.apache.org by "Aias00 (via GitHub)" <gi...@apache.org> on 2026/09/30 06:40:15 UTC

[I] [Bug] Default date converters silently normalize invalid calendar dates [fesod]

Aias00 opened a new issue, #1157:
URL: https://github.com/apache/fesod/issues/1157

   ### Fesod version
   
   Current `main` at `5a9a16b`.
   
   ### Description
   
   Default string-to-date conversion is lenient. Invalid calendar dates are silently changed into different valid dates instead of failing conversion.
   
   ### Location
   
   - `fesod-sheet/src/main/java/org/apache/fesod/sheet/util/DateUtils.java:378-395`
   - `fesod-sheet/src/main/java/org/apache/fesod/sheet/util/DateUtils.java:398-411`
   
   `SimpleDateFormat` keeps its default lenient behavior. `DateTimeFormatter.ofPattern` uses SMART resolver behavior unless made strict.
   
   ### Reproduction
   
   ```java
   DateUtils.parseDate("2024-02-31");
   // formats back as 2024-03-02
   
   DateUtils.parseLocalDate("2024-02-31", null, Locale.US);
   // returns 2024-02-29
   ```
   
   A valid control value such as `2024-02-29` remains unchanged.
   
   ### Expected behavior
   
   Invalid calendar dates should raise a conversion error. Importing malformed spreadsheet text must not silently change the represented date.
   
   ### Suggested fix
   
   Disable lenient `SimpleDateFormat` parsing and use strict resolver semantics for java.time parsing. Account for `yyyy` versus `uuuu` when making existing patterns strict, and add converter-level regression tests for invalid month-end and leap-day values.
   
   ### Related existing work
   
   #1116/#1117 cover negative Excel serial dates. #1040 covers locale handling. Neither covers invalid string dates being normalized.
   
   ### Are you willing to submit a PR?
   
   Yes.
   


-- 
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: commits-unsubscribe@fesod.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org


Re: [I] [Bug] Default date converters silently normalize invalid calendar dates [fesod]

Posted by "BigDataDZ (via GitHub)" <gi...@apache.org>.
BigDataDZ commented on issue #1157:
URL: https://github.com/apache/fesod/issues/1157#issuecomment-5975769373

   I would like to work on this. Plan: make the SimpleDateFormat-based parsing non-lenient and switch the java.time parsing to ResolverStyle.STRICT (rewriting year-of-era y to u where patterns have no era field), then add converter-level regression tests for invalid month-end and leap-day strings like 2024-02-31 / 2023-02-29 on both the legacy Date and java.time paths.


-- 
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: commits-unsubscribe@fesod.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org


Re: [I] [Bug] Default date converters silently normalize invalid calendar dates [fesod]

Posted by "bengbengbalabalabeng (via GitHub)" <gi...@apache.org>.
bengbengbalabalabeng commented on issue #1157:
URL: https://github.com/apache/fesod/issues/1157#issuecomment-6039573077

   > I would like to work on this. Plan: make the SimpleDateFormat-based parsing non-lenient and switch the java.time parsing to ResolverStyle.STRICT (rewriting year-of-era y to u where patterns have no era field), then add converter-level regression tests for invalid month-end and leap-day strings like 2024-02-31 / 2023-02-29 on both the legacy Date and java.time paths.
   
   Thank you for your interest. There is already a corresponding fix PR (#1167) for this issue. If you'd like, you're also welcome to review it or add further comments to the discussion here.


-- 
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: commits-unsubscribe@fesod.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org


Re: [I] [Bug] Default date converters silently normalize invalid calendar dates [fesod]

Posted by "bengbengbalabalabeng (via GitHub)" <gi...@apache.org>.
bengbengbalabalabeng closed issue #1157: [Bug] Default date converters silently normalize invalid calendar dates
URL: https://github.com/apache/fesod/issues/1157


-- 
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: commits-unsubscribe@fesod.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org