Repository navigation
#402 - date_parser: reject the out-of-range dates, cast the scalar inputs, explicit error on the other inputs - #403
Merged
Merged
Conversation
…puts, explicit error on the other inputs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #402.
\DateTime::createFromFormat(),DateParserTransformerchecks\DateTime::getLastErrors(). Its warnings (e.g. "The parsed date was invalid", "The parsed time was invalid") throw anUnexpectedValueExceptionnaming the value. Until now,2024-02-31gave2024-03-02,2024-13-01gave2025-01-01and25:61was accepted. A leap day is still accepted.inttimestamp with theUformat) or a\Stringableis cast to string. An array or another object throws anUnexpectedValueExceptionwith the type, instead of a rawTypeError. The falsy values,\DateTimeand\DateTimeImmutableare handled as before.Requirements
Breaking changes
None in the API. An out-of-range date, silently shifted until now, makes the transformer fail, as the documentation said for a value that cannot be parsed.
🤖 Generated with Claude Code