-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Date\TimeType marked as invalid on request with single_text and zero seconds #30253
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
Comments
This is not a bug. When using a string as the input data it currently is expected to be in the format |
Or always add seconds if they are missing, similar to this:
Fact is: |
I prefer your solution though, If I want to save the time as a string I want control of how the string looks. |
Can you show how you currently build your form? |
Like this:
|
Adding the above mentioned event listener when |
In theory yes, but for some reason the event listener is not called. Tried it with this:
|
Rereading the initial description now: Are you sure this happens on submission of the form? This rather looks like it is related to passing the wrong for 8000 mat when the initial data is set. |
Yes, this happens when the form is submitted in the browser. The value that is produced by the https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time#Time_value_format
|
I am sorry, but I cannot reproduce this issue. Can you create a small example application that allows to reproduce? |
You were correct, this happened because the initial data was not in the expected format. Sorry for wasting everyones time. |
Thank you for the feedback. 👍 |
For the records: with #30358 we will also be able to customise the input format for the |
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected: 3.4 up to 4.2
Description
Submitting a TimeType without seconds and with input option set to "string" causes an TransformationFailedException.
Possible Solution
Change 'H:i:s' to $format in src/Symfony/Component/Form/Extension/Core/Type/TimeType.php at line 167
Additional context
The text was updated successfully, but these errors were encountered: