Skip to content

Commit 579215f

Browse files
committed
Merge pull request symfony#3466 from bicpi/add_missing_datetime_format_form_options
[Reference][Form Types] Add missing "format" option to "datetime" field
2 parents b804087 + 127b089 commit 579215f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

reference/forms/types/datetime.rst

+14
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ data can be a ``DateTime`` object, a string, a timestamp or an array.
2020
| | - `widget`_ |
2121
| | - `input`_ |
2222
| | - `date_format`_ |
23+
| | - `format`_ |
2324
| | - `hours`_ |
2425
| | - `minutes`_ |
2526
| | - `seconds`_ |
@@ -98,6 +99,17 @@ Defines the ``format`` option that will be passed down to the date field.
9899
See the :ref:`date type's format option <reference-forms-type-date-format>`
99100
for more details.
100101

102+
format
103+
~~~~~~
104+
105+
**type**: ``string`` **default**: ``Symfony\Component\Form\Extension\Core\Type\DateTimeType::HTML5_FORMAT``
106+
107+
If the ``widget`` option is set to ``single_text``, this option specifies the
108+
the format of the input, i.e. how Symfony will interpret the given input
109+
as a datetime string. It defaults to the `RFC 3339`_ format which is used
110+
by the HTML5 ``datetime`` field. Keeping the default value will cause the
111+
field to be rendered as an ``input`` field with ``type="datetime"``.
112+
101113
.. include:: /reference/forms/types/options/hours.rst.inc
102114

103115
.. include:: /reference/forms/types/options/minutes.rst.inc
@@ -138,3 +150,5 @@ These options inherit from the :doc:`form </reference/forms/types/form>` type:
138150
.. include:: /reference/forms/types/options/mapped.rst.inc
139151

140152
.. include:: /reference/forms/types/options/inherit_data.rst.inc
153+
154+
.. _`RFC 3339`: http://tools.ietf.org/html/rfc3339

0 commit comments

Comments
 (0)