pearu opened a new pull request, #54657:
URL: https://github.com/apache/arrow/pull/54657

   ### Rationale for this change
   
   `strptime` checks the day of month against 31 at most, and some 
implementations (macOS, the vendored musl used on Windows) accept day `00`. The 
parser rolled an impossible date such as February 30 over into the next month, 
and took a zero day as the first of the month.
   
   ### What changes are included in this PR?
   
   The parser rejects the parsed date if it is not valid, as the ISO-8601 
parser does. To tell a zero day from an omitted one, the day is initialized to 
the first before parsing, instead of being raised to the first afterwards. The 
two fixes are in one PR because the zero-day fix relies on the date check.
   
   ### Are these changes tested?
   
   Yes, in `TimestampParser.StrptimeParser` (impossible dates, a zero day, and 
February 29 of a leap year) and `TimestampParser.StrptimeWithoutDay` (a format 
without a day directive still gives the first of the month). The zero-day case 
only fails without the fix on platforms whose `strptime` accepts day `00`.
   
   ### Are there any user-facing changes?
   
   Impossible dates and a zero day no longer parse with `strptime` formats.
   
   ### AI usage disclosure
   
   Developed with AI assistance (Claude Code): the fix, the tests and this 
description were AI-generated under my direction and reviewed line by line by 
me. I own and can debug these changes. No copyrighted material is included.
   
   * GitHub Issue: #54643
   


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

Reply via email to