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] Add input_format option to DateType and DateTimeType#29887
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
[Form] Add input_format option to DateType and DateTimeType#29887
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| 'empty_data' =>function (Options$options) { | ||
| return$options['compound'] ?array() :''; | ||
| }, | ||
| 'input_format' =>'Y-m-d H:i:s', |
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.
Should we set the default here or rely on the transformer default ? IMHO, it's better here so the form type and the transformer are more decoupled.
| 'choice', | ||
| )); | ||
| $resolver->setAllowedTypes('input_format','string'); |
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.
Should we validate the passedinput_format ?
a7303a6 to12c80e8Compare164ec2e tob4b1296Compareb4b1296 to869bbdeComparexabbuh commentedFeb 2, 2019
@fancyweb Can you rebase here? |
869bbde to7de0120Compare| return''; | ||
| }); | ||
| $resolver->setAllowedTypes('input_format','string'); |
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.
symfony/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
Lines 298 to 299 ina6a1be8
| returnsprintf('Using the "date_format" option of %s when the "widget" option is set to "single_text" is deprecated since Symfony 4.3 and will lead to an exception in 5.0.',self::class); | |
| //throw new LogicException(sprintf('Cannot use the "date_format" option of the %s when the "widget" option is set to "single_text".', self::class)); |
As we are going to do with the
time_widget option, I wonder if we should throw an exception when the input_format is passed and the value ofinput is not strictly equal to string'.xabbuh commentedFeb 15, 2019
@fancyweb Can you rebase here? |
7de0120 toef26ad0Compareef26ad0 toc8240a0Comparexabbuh commentedFeb 20, 2019
Thank you@fancyweb. |
…eType (fancyweb)This PR was merged into the 4.3-dev branch.Discussion----------[Form] Add input_format option to DateType and DateTimeType| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#29883| License | MIT| Doc PR |symfony/symfony-docs#10882Add a new option to specify the date format when using the `string` input type.Commits-------c8240a0 [Form] Add input_format option to DateType and DateTimeType
…xabbuh)This PR was merged into the 4.3-dev branch.Discussion----------[Form] be able to specify the input format for times| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets || License | MIT| Doc PR |This expands the work started in#29887 to also allow to configure the input format for string inputs in the `TimeType`.Commits-------2d9bc18 be able to specify the input format for times
… and TimeType (fancyweb)This PR was squashed before being merged into the master branch (closes#10882).Discussion----------[Form] Add input_format option to DateType, DateTimeType and TimeTypeRelated Symfony PRs :symfony/symfony#29887 andsymfony/symfony#30358Commits-------8fc1b53 [Form] Add input_format option to DateType, DateTimeType and TimeType
Uh oh!
There was an error while loading.Please reload this page.
Add a new option to specify the date format when using the
stringinput type.