Skip to content

Commit 8cfb850

Browse files
committed
[Reference][Form Types] Document "with_minutes" time/datetime option
1 parent 0428c57 commit 8cfb850

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

reference/forms/types/datetime.rst

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ data can be a ``DateTime`` object, a string, a timestamp or an array.
2626
| | - `years`_ |
2727
| | - `months`_ |
2828
| | - `days`_ |
29+
| | - `with_minutes`_ |
2930
| | - `with_seconds`_ |
3031
| | - `model_timezone`_ |
3132
| | - `view_timezone`_ |
@@ -109,6 +110,8 @@ for more details.
109110

110111
.. include:: /reference/forms/types/options/days.rst.inc
111112

113+
.. include:: /reference/forms/types/options/with_minutes.rst.inc
114+
112115
.. include:: /reference/forms/types/options/with_seconds.rst.inc
113116

114117
.. include:: /reference/forms/types/options/model_timezone.rst.inc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
with_minutes
2+
~~~~~~~~~~~~
3+
4+
**type**: ``Boolean`` **default**: ``true``
5+
6+
Whether or not to include minutes in the input. This will result in an additional
7+
input to capture minutes.
8+
9+
.. versionadded:: 2.2
10+
The ``with_minutes`` option was introduced in Symfony 2.2.

reference/forms/types/time.rst

+14-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ as a ``DateTime`` object, a string, a timestamp or an array.
1717
+----------------------+-----------------------------------------------------------------------------+
1818
| Options | - `widget`_ |
1919
| | - `input`_ |
20+
| | - `with_minutes`_ |
2021
| | - `with_seconds`_ |
2122
| | - `hours`_ |
2223
| | - `minutes`_ |
@@ -83,13 +84,21 @@ widget
8384

8485
The basic way in which this field should be rendered. Can be one of the following:
8586

86-
* ``choice``: renders two (or three if `with_seconds`_ is true) select inputs.
87+
* ``choice``: renders one, two (default) or three select inputs (hour, minute,
88+
second), depending on the `with_minutes`_ and `with_seconds`_ options.
8789

88-
* ``text``: renders a two or three text inputs (hour, minute, second).
90+
* ``text``: renders one, two (default) or three text inputs (hour, minute,
91+
second), depending on the `with_minutes`_ and `with_seconds`_ options.
8992

90-
* ``single_text``: renders a single input of type text. User's input will
93+
* ``single_text``: renders a single input of type ``time``. User's input will
9194
be validated against the form ``hh:mm`` (or ``hh:mm:ss`` if using seconds).
9295

96+
.. caution::
97+
98+
Combining the widget type ``single_text`` and the `with_minutes`_ option
99+
set to ``false`` can cause unexpected behavior in the client as the input
100+
type ``time`` might not support selecting an hour only.
101+
93102
input
94103
~~~~~
95104

@@ -106,6 +115,8 @@ your underlying object. Valid values are:
106115
The value that comes back from the form will also be normalized back into
107116
this format.
108117

118+
.. include:: /reference/forms/types/options/with_minutes.rst.inc
119+
109120
.. include:: /reference/forms/types/options/with_seconds.rst.inc
110121

111122
.. include:: /reference/forms/types/options/hours.rst.inc

0 commit comments

Comments
 (0)