Skip to content

Commit b314c31

Browse files
fancywebandrew-demb
andcommitted
[Form] Add input_format option to DateType and DateTimeType
Co-Authored-By: Andrii Dembitskyi <[email protected]>
1 parent f760075 commit b314c31

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

reference/forms/types/birthday.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ option defaults to 120 years ago to the current year.
2929
| | - `placeholder`_ |
3030
| | - `format`_ |
3131
| | - `input`_ |
32+
| | - `input_format`_ |
3233
| | - `model_timezone`_ |
3334
| | - `months`_ |
3435
| | - `view_timezone`_ |
@@ -96,6 +97,8 @@ values for the year, month and day fields::
9697

9798
.. include:: /reference/forms/types/options/date_input.rst.inc
9899

100+
.. include:: /reference/forms/types/options/date_input_format.rst.inc
101+
99102
.. include:: /reference/forms/types/options/model_timezone.rst.inc
100103

101104
.. include:: /reference/forms/types/options/months.rst.inc

reference/forms/types/date.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ and can understand a number of different input formats via the `input`_ option.
2121
| | - `format`_ |
2222
| | - `html5`_ |
2323
| | - `input`_ |
24+
| | - `input_format`_ |
2425
| | - `model_timezone`_ |
2526
| | - `months`_ |
2627
| | - `view_timezone`_ |
@@ -168,6 +169,8 @@ values for the year, month and day fields::
168169

169170
.. include:: /reference/forms/types/options/date_input.rst.inc
170171

172+
.. include:: /reference/forms/types/options/date_input_format.rst.inc
173+
171174
.. include:: /reference/forms/types/options/model_timezone.rst.inc
172175

173176
.. include:: /reference/forms/types/options/months.rst.inc

reference/forms/types/datetime.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ the data can be a ``DateTime`` object, a string, a timestamp or an array.
2525
| | - `hours`_ |
2626
| | - `html5`_ |
2727
| | - `input`_ |
28+
| | - `input_format`_ |
2829
| | - `minutes`_ |
2930
| | - `model_timezone`_ |
3031
| | - `months`_ |
@@ -153,6 +154,13 @@ this format.
153154

154155
.. include:: /reference/forms/types/options/_date_limitation.rst.inc
155156

157+
input_format
158+
~~~~~~~~~~~~
159+
160+
**type**: ``string`` **default**: ``Y-m-d H:i:s``
161+
162+
.. include:: /reference/forms/types/options/date_input_format_description.rst.inc
163+
156164
.. include:: /reference/forms/types/options/minutes.rst.inc
157165

158166
.. include:: /reference/forms/types/options/model_timezone.rst.inc
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
input_format
2+
~~~~~~~~~~~~
3+
4+
**type**: ``string`` **default**: ``Y-m-d``
5+
6+
.. include:: /reference/forms/types/options/date_input_format_description.rst.inc
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
If the ``input`` option is set to ``string``, this option specifies the format
2+
of the date. This must be a valid `PHP date format`_.
3+
4+
.. _`PHP date format`: https://secure.php.net/manual/en/function.date.php

0 commit comments

Comments
 (0)