-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
DateIntervalNormalizer does not support weeks and days together #47629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
Hey, thanks for your report! |
Just a quick reminder to make a comment on this. If I don't hear anything I'll close this. |
this is still an issue, let's keep it open, I think I can open a PR for it, maybe sometime this week |
nicolas-grekas
added a commit
that referenced
this issue
Nov 20, 2023
…weeks and days (oneNevan) This PR was merged into the 5.4 branch. Discussion ---------- [Serializer] Fix denormalizing date intervals having both weeks and days | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #47629 | License | MIT Added support for date periods having both W and D period designators combined together (which is valid duration for ISO 8601-2). Starting from PHP 8 this is supported by \DateTimeInterval, see https://bugs.php.net/bug.php?id=61366 for reference Commits ------- c88d49e [Serializer] Fix denormalizing date intervals having both weeks and days
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Symfony version(s) affected
5.4.12,6.1.4
Description
Since PHP 8.0 DateInterval::construct supports periods containing both D and W period designators
The problem is the built-in DateIntervalNormalizer does not support it, so it throws exception if both weeks and date exist in source period string as current regular expression in method isISO8601 does not allow it
How to reproduce
Possible Solution
I believe a possible solution would be to update regular expression used in isISO8601 method for PHP versions >= 8.0, like this:
Additional Context
No response
The text was updated successfully, but these errors were encountered: