Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Form] reverse transform RFC 3339 formatted dates#28712
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| } | ||
| if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})[T ]\d{2}:\d{2}(?::\d{2})?$/',$dateTimeLocal,$matches)) { | ||
| if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})[T ]\d{2}:\d{2}(?::\d{2})?(?:\.\d)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))?$/',$dateTimeLocal,$matches)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Maybe it would be possible to also support timezone without ":"?if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})[T ]\d{2}:\d{2}(?::\d{2})?(?:\.\d)?(?:Z|(?:(?:\+|-)\d{2}:\d{2})|(?:\+|-)\d{4})?$/', $dateTimeLocal, $matches)) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can you give an example string of what you have in mind so I can add it to the tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
2018-09-15T10:00:00+0200
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
done, thank you for the feedback
Technically, dates formatted according to the HTML specifications do notcontain any timezone information. But since our DateTimeType used tocontain this information in the passed, users had configure their JSlibraries to accept (and create) dates in that format.To not break BC we should accept these dates and silently ignore theadditional timezone information.
HeahDude left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for fixing this!
Shouldn't we deprecate this behavior in master to be able to use a strict check in Symfony 5?
magnetik commentedOct 4, 2018
+1 for being clearer about what should work and not to be able to be stricter in the future |
xabbuh commentedOct 4, 2018
@HeahDude Yeah, I am already preparing some PRs to improve DX around this. |
xabbuh commentedOct 4, 2018
danrot commentedOct 4, 2018
@xabbuh Do you already know if this will be accepted? Because if it is not we have to fix our JS, otherwise we would only have to add this version as conflict, and we could release a new working version immediately. |
xabbuh commentedOct 4, 2018
@danrot Adding the conflict rule will be enough. |
danrot commentedOct 10, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I've added the conflict for symfony 3.4.16 and 3.4.17 in ourcomposer.json, but if you don't set our latest version (1.6.22) as minimum in the project composer.json, composer will install Sulu 1.6.21, so that it can use Symfony 3.4.17, which then still breaks the installation (hope you understand what I mean, otherwise I can elaborate further 🙈). So people are really struggling with the installation of our product... Is there any other thing we can do, apart from kindly asking you to get this merged and release it? 😊 |
YetiCGN commentedOct 10, 2018
Huh? I have |
danrot commentedOct 10, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Just tested it again, had a project with - "sulu/sulu": "~1.6.22",+ "sulu/sulu": "~1.6.0", Then I executed another In addition to that composer even tells me that Symfony is the reason for not installing 1.6.22: Just realized that it works, if the |
YetiCGN commentedOct 10, 2018
Ah! See, we have |
danrot commentedOct 10, 2018
And since |
YetiCGN commentedOct 10, 2018
Anyhow, please somebody merge this to the LTS branches 2.8 and 3.4 so we can safely rely on backwards compatibility again. 🙂 |
nicolas-grekas commentedOct 14, 2018
Thank you@xabbuh. |
This PR was merged into the 2.8 branch.Discussion----------[Form] reverse transform RFC 3339 formatted dates| Q | A| ------------- | ---| Branch? | 2.8| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#28699| License | MIT| Doc PR |Technically, dates formatted according to the HTML specifications do notcontain any timezone information. But since our DateTimeType used tocontain this information in the passed, users had configure their JSlibraries to accept (and create) dates in that format.To not break BC we should accept these dates and silently ignore theadditional timezone information.Commits-------503239f reverse transform RFC 3339 formatted dates
Technically, dates formatted according to the HTML specifications do not
contain any timezone information. But since our DateTimeType used to
contain this information in the passed, users had configure their JS
libraries to accept (and create) dates in that format.
To not break BC we should accept these dates and silently ignore the
additional timezone information.