Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Form] Support \DateTimeImmutable#25582

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

Closed

Conversation

@vudaltsov
Copy link
Contributor

@vudaltsovvudaltsov commentedDec 22, 2017
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#9508
LicenseMIT
Doc PRsymfony/symfony-docs#8920

This PR implementsinput=datetime_immutable. Replaces#25273.

apetitpa, ste93cry, and andreybolonin reacted with thumbs up emoji
throw new TransformationFailedException('Expected a \DateTimeImmutable.');
}

return new \DateTime($value->format(\DateTime::RFC3339));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Maybe usecreateFromFormat here to remove the need for PHP to guess the date format.

vudaltsov reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@jvasseur , good idea, thanx.

@nicolas-grekasnicolas-grekas added this to the4.1 milestoneDec 22, 2017
*
* @throws TransformationFailedException If the given value is not a \DateTimeImmutable
*/
public function transform($value): ?\DateTime
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Adding the return type hint breaks the prototype.

*
* @throws TransformationFailedException If the given value is not a \DateTime
*/
public function reverseTransform($value): ?\DateTimeImmutable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Adding the return type hint breaks the prototype.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

thank you, fixed!

@nicolas-grekas
Copy link
Member

Status: needs work

@vudaltsov
Copy link
ContributorAuthor

Status: Needs Review

@vudaltsov
Copy link
ContributorAuthor

Anything else needed here?

Copy link
Contributor

@HeahDudeHeahDude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is a nice approach to leverage the feature without too much overhead, until we make the required change to make it the default norm format.
LGTM

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

(small rebase needed)

@vudaltsov
Copy link
ContributorAuthor

Rebased. Added a changelog entry and replaced previously addedassertDateTimeImmutableEquals withassertEqual.

If everything's good after this, I will squash commits.

@fabpot
Copy link
Member

Thank you@vudaltsov.

vudaltsov reacted with hooray emoji

@ste93cry
Copy link
Contributor

Are there plans to port this to at least Symfony 3.4?

@derrabus
Copy link
Member

@ste93cry Since this is considered to be a new feature, it most likely won't land in 3.4, which is in bugfix-only mode.

@vudaltsov
Copy link
ContributorAuthor

@ste93cry , during this week-end I will create a small bundle to add this functionality to earlier Symfony versions.

xabbuh reacted with thumbs up emojiste93cry reacted with hooray emoji

javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestFeb 9, 2018
…ateTimeType (vudaltsov)This PR was merged into the master branch.Discussion----------[Form] input=datetime_immutable for DateType, TimeType, DateTimeTypeRelated tosymfony/symfony#25582.Commits-------f6bf5f2 Added input=datetime_immutable for DateType, TimeType, DateTimeType.
@vudaltsovvudaltsov deleted the form-datetime-immutable branchFebruary 11, 2018 10:17
@vudaltsov
Copy link
ContributorAuthor

Created apolyfill bundle for those who want to useinput=datetime_immutable with Symfony (>=2.8 <4.1).

HeahDude reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

+3 more reviewers

@hhamonhhamonhhamon left review comments

@jvasseurjvasseurjvasseur left review comments

@HeahDudeHeahDudeHeahDude approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.1

Development

Successfully merging this pull request may close these issues.

9 participants

@vudaltsov@nicolas-grekas@fabpot@ste93cry@derrabus@hhamon@jvasseur@HeahDude@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp