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] 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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| throw new TransformationFailedException('Expected a \DateTimeImmutable.'); | ||
| } | ||
| return new \DateTime($value->format(\DateTime::RFC3339)); |
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 usecreateFromFormat here to remove the need for PHP to guess the date format.
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.
@jvasseur , good idea, thanx.
| * | ||
| * @throws TransformationFailedException If the given value is not a \DateTimeImmutable | ||
| */ | ||
| public function transform($value): ?\DateTime |
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.
Adding the return type hint breaks the prototype.
| * | ||
| * @throws TransformationFailedException If the given value is not a \DateTime | ||
| */ | ||
| public function reverseTransform($value): ?\DateTimeImmutable |
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.
Adding the return type hint breaks the prototype.
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.
thank you, fixed!
nicolas-grekas commentedJan 7, 2018
Status: needs work |
vudaltsov commentedJan 8, 2018
Status: Needs Review |
vudaltsov commentedJan 27, 2018
Anything else needed here? |
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.
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
nicolas-grekas 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.
(small rebase needed)
73a5215 to7721aedComparevudaltsov commentedFeb 6, 2018
Rebased. Added a changelog entry and replaced previously added If everything's good after this, I will squash commits. |
fabpot commentedFeb 7, 2018
Thank you@vudaltsov. |
ste93cry commentedFeb 9, 2018
Are there plans to port this to at least Symfony 3.4? |
derrabus commentedFeb 9, 2018
@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 commentedFeb 9, 2018
@ste93cry , during this week-end I will create a small bundle to add this functionality to earlier Symfony versions. |
…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.
vudaltsov commentedFeb 11, 2018
Created apolyfill bundle for those who want to use |
Uh oh!
There was an error while loading.Please reload this page.
This PR implements
input=datetime_immutable. Replaces#25273.