From c1d6df47fdacc6d8580e4b57c10040f9205ed951 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sat, 11 Jan 2014 21:24:10 +0100 Subject: [PATCH 1/2] [Reference][Form Types] Add missing "format" option to "datetime" field --- reference/forms/types/datetime.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/reference/forms/types/datetime.rst b/reference/forms/types/datetime.rst index 5db418b44f3..125b42dac5a 100644 --- a/reference/forms/types/datetime.rst +++ b/reference/forms/types/datetime.rst @@ -20,6 +20,7 @@ data can be a ``DateTime`` object, a string, a timestamp or an array. | | - `widget`_ | | | - `input`_ | | | - `date_format`_ | +| | - `format`_ | | | - `hours`_ | | | - `minutes`_ | | | - `seconds`_ | @@ -98,6 +99,17 @@ Defines the ``format`` option that will be passed down to the date field. See the :ref:`date type's format option ` for more details. +format +~~~~~~ + +**type**: ``string`` **default**: ``Symfony\Component\Form\Extension\Core\Type\DateTimeType::HTML5_FORMAT`` + +If the ``widget`` option is set to ``single_text``, this option specifies the +the format of the input, i.e. how Symfony will interpret the given input +as a datetime string. It defaults to the `RFC 3339`_ format which is used +by the HTML5 ``datetime`` field. Keeping the default will render a field of +type ``datetime``. + .. include:: /reference/forms/types/options/hours.rst.inc .. include:: /reference/forms/types/options/minutes.rst.inc @@ -138,3 +150,5 @@ These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/mapped.rst.inc .. include:: /reference/forms/types/options/inherit_data.rst.inc + +.. _`RFC 3339`: http://tools.ietf.org/html/rfc3339 From 127b08909efde7127879be053ed84e33f76ed46d Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Thu, 23 Jan 2014 07:32:06 +0100 Subject: [PATCH 2/2] Be more specific for the rendered field type --- reference/forms/types/datetime.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/forms/types/datetime.rst b/reference/forms/types/datetime.rst index 125b42dac5a..82597469fc9 100644 --- a/reference/forms/types/datetime.rst +++ b/reference/forms/types/datetime.rst @@ -107,8 +107,8 @@ format If the ``widget`` option is set to ``single_text``, this option specifies the the format of the input, i.e. how Symfony will interpret the given input as a datetime string. It defaults to the `RFC 3339`_ format which is used -by the HTML5 ``datetime`` field. Keeping the default will render a field of -type ``datetime``. +by the HTML5 ``datetime`` field. Keeping the default value will cause the +field to be rendered as an ``input`` field with ``type="datetime"``. .. include:: /reference/forms/types/options/hours.rst.inc