Skip to content

[Form][DateTimeImmutableToDateTimeTransformer] Preserve microseconds and use \DateTime::createFromImmutable() when available #33885

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

Merged

Conversation

fancyweb
Copy link
Contributor

@fancyweb fancyweb commented Oct 7, 2019

Q A
Branch? 4.3
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

For PHP >= 7.3, we should use \DateTime::createFromImmutable() directly.

This patch also preserves the \DateTime microseconds when the conversion is done with \DateTime::createFromFormat().

…and use \DateTime::createFromImmutable() when available
@fancyweb fancyweb force-pushed the form-fix-dti-to-dt-transformer branch from 84f05f2 to dfa2303 Compare October 7, 2019 13:06
@nicolas-grekas nicolas-grekas added this to the 4.3 milestone Oct 8, 2019
@nicolas-grekas
Copy link
Member

Thank you @fancyweb.

nicolas-grekas added a commit that referenced this pull request Oct 8, 2019
…croseconds and use \DateTime::createFromImmutable() when available (fancyweb)

This PR was merged into the 4.3 branch.

Discussion
----------

[Form][DateTimeImmutableToDateTimeTransformer] Preserve microseconds and use \DateTime::createFromImmutable() when available

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

For PHP >= 7.3, we should use [\DateTime::createFromImmutable()](https://www.php.net/manual/en/datetime.createfromimmutable.php) directly.

This patch also preserves the `\DateTime` microseconds when the conversion is done with `\DateTime::createFromFormat()`.

Commits
-------

dfa2303 [Form][DateTimeImmutableToDateTimeTransformer] Preserve microseconds and use \DateTime::createFromImmutable() when available
@nicolas-grekas nicolas-grekas merged commit dfa2303 into symfony:4.3 Oct 8, 2019
@fancyweb fancyweb deleted the form-fix-dti-to-dt-transformer branch October 8, 2019 11:34
@fabpot fabpot mentioned this pull request Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants