From b314c3158b4bc61544283a94b46a43cb8b1096cf Mon Sep 17 00:00:00 2001 From: fancyweb Date: Mon, 14 Jan 2019 22:31:45 +0100 Subject: [PATCH 1/2] [Form] Add input_format option to DateType and DateTimeType Co-Authored-By: Andrii Dembitskyi --- reference/forms/types/birthday.rst | 3 +++ reference/forms/types/date.rst | 3 +++ reference/forms/types/datetime.rst | 8 ++++++++ reference/forms/types/options/date_input_format.rst.inc | 6 ++++++ .../types/options/date_input_format_description.rst.inc | 4 ++++ 5 files changed, 24 insertions(+) create mode 100644 reference/forms/types/options/date_input_format.rst.inc create mode 100644 reference/forms/types/options/date_input_format_description.rst.inc diff --git a/reference/forms/types/birthday.rst b/reference/forms/types/birthday.rst index cb4281fb370..257e13dcc42 100644 --- a/reference/forms/types/birthday.rst +++ b/reference/forms/types/birthday.rst @@ -29,6 +29,7 @@ option defaults to 120 years ago to the current year. | | - `placeholder`_ | | | - `format`_ | | | - `input`_ | +| | - `input_format`_ | | | - `model_timezone`_ | | | - `months`_ | | | - `view_timezone`_ | @@ -96,6 +97,8 @@ values for the year, month and day fields:: .. include:: /reference/forms/types/options/date_input.rst.inc +.. include:: /reference/forms/types/options/date_input_format.rst.inc + .. include:: /reference/forms/types/options/model_timezone.rst.inc .. include:: /reference/forms/types/options/months.rst.inc diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst index 16dcae7c1fe..2ecbbc4961b 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -21,6 +21,7 @@ and can understand a number of different input formats via the `input`_ option. | | - `format`_ | | | - `html5`_ | | | - `input`_ | +| | - `input_format`_ | | | - `model_timezone`_ | | | - `months`_ | | | - `view_timezone`_ | @@ -168,6 +169,8 @@ values for the year, month and day fields:: .. include:: /reference/forms/types/options/date_input.rst.inc +.. include:: /reference/forms/types/options/date_input_format.rst.inc + .. include:: /reference/forms/types/options/model_timezone.rst.inc .. include:: /reference/forms/types/options/months.rst.inc diff --git a/reference/forms/types/datetime.rst b/reference/forms/types/datetime.rst index a50b2ce7061..efb5a80435b 100644 --- a/reference/forms/types/datetime.rst +++ b/reference/forms/types/datetime.rst @@ -25,6 +25,7 @@ the data can be a ``DateTime`` object, a string, a timestamp or an array. | | - `hours`_ | | | - `html5`_ | | | - `input`_ | +| | - `input_format`_ | | | - `minutes`_ | | | - `model_timezone`_ | | | - `months`_ | @@ -153,6 +154,13 @@ this format. .. include:: /reference/forms/types/options/_date_limitation.rst.inc +input_format +~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``Y-m-d H:i:s`` + +.. include:: /reference/forms/types/options/date_input_format_description.rst.inc + .. include:: /reference/forms/types/options/minutes.rst.inc .. include:: /reference/forms/types/options/model_timezone.rst.inc diff --git a/reference/forms/types/options/date_input_format.rst.inc b/reference/forms/types/options/date_input_format.rst.inc new file mode 100644 index 00000000000..ead92072642 --- /dev/null +++ b/reference/forms/types/options/date_input_format.rst.inc @@ -0,0 +1,6 @@ +input_format +~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``Y-m-d`` + +.. include:: /reference/forms/types/options/date_input_format_description.rst.inc diff --git a/reference/forms/types/options/date_input_format_description.rst.inc b/reference/forms/types/options/date_input_format_description.rst.inc new file mode 100644 index 00000000000..e411cd12d70 --- /dev/null +++ b/reference/forms/types/options/date_input_format_description.rst.inc @@ -0,0 +1,4 @@ +If the ``input`` option is set to ``string``, this option specifies the format +of the date. This must be a valid `PHP date format`_. + +.. _`PHP date format`: https://secure.php.net/manual/en/function.date.php From cfec9d6876838b1ab9bb8ba16aded33f08881e80 Mon Sep 17 00:00:00 2001 From: fancyweb Date: Tue, 5 Mar 2019 18:43:39 +0100 Subject: [PATCH 2/2] [Form] Add input_format option to TimeType --- .../options/date_input_format_description.rst.inc | 4 ++++ reference/forms/types/time.rst | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/reference/forms/types/options/date_input_format_description.rst.inc b/reference/forms/types/options/date_input_format_description.rst.inc index e411cd12d70..4cd9b353e31 100644 --- a/reference/forms/types/options/date_input_format_description.rst.inc +++ b/reference/forms/types/options/date_input_format_description.rst.inc @@ -1,3 +1,7 @@ +.. versionadded:: 4.3 + + The ``input_format`` option was introduced in Symfony 4.3. + If the ``input`` option is set to ``string``, this option specifies the format of the date. This must be a valid `PHP date format`_. diff --git a/reference/forms/types/time.rst b/reference/forms/types/time.rst index 9c39dabccff..9c9c09865d0 100644 --- a/reference/forms/types/time.rst +++ b/reference/forms/types/time.rst @@ -20,6 +20,7 @@ stored as a ``DateTime`` object, a string, a timestamp or an array. | | - `hours`_ | | | - `html5`_ | | | - `input`_ | +| | - `input_format`_ | | | - `minutes`_ | | | - `model_timezone`_ | | | - `seconds`_ | @@ -129,6 +130,18 @@ on your underlying object. Valid values are: The value that comes back from the form will also be normalized back into this format. +input_format +~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``H:i:s`` + +.. versionadded:: 4.3 + + The ``input_format`` option was introduced in Symfony 4.3. + +If the ``input`` option is set to ``string``, this option specifies the format +of the time. This must be a valid `PHP time format`_. + .. include:: /reference/forms/types/options/minutes.rst.inc .. include:: /reference/forms/types/options/model_timezone.rst.inc @@ -222,3 +235,5 @@ Form Variables | type | ``string`` | Only present when widget is ``single_text`` and HTML5 is activated, | | | | contains the input type to use (``datetime``, ``date`` or ``time``). | +--------------+-------------+----------------------------------------------------------------------+ + +.. _`PHP time format`: https://secure.php.net/manual/en/function.date.php pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy