diff --git a/reference/forms/types/datetime.rst b/reference/forms/types/datetime.rst index 66f82abbc12..c18ac7cf524 100644 --- a/reference/forms/types/datetime.rst +++ b/reference/forms/types/datetime.rst @@ -17,6 +17,7 @@ the data can be a ``DateTime`` object, a string, a timestamp or an array. +----------------------+-----------------------------------------------------------------------------+ | Options | - `choice_translation_domain`_ | | | - `date_format`_ | +| | - `date_label`_ | | | - `date_widget`_ | | | - `days`_ | | | - `placeholder`_ | @@ -28,6 +29,7 @@ the data can be a ``DateTime`` object, a string, a timestamp or an array. | | - `model_timezone`_ | | | - `months`_ | | | - `seconds`_ | +| | - `time_label`_ | | | - `time_widget`_ | | | - `view_timezone`_ | | | - `widget`_ | @@ -67,6 +69,23 @@ Defines the ``format`` option that will be passed down to the date field. See the :ref:`DateType's format option ` for more details. +date_label +~~~~~~~~~~ + +**type**: ``string`` | ``null`` **default**: The label is "guessed" from the field name + +.. versionadded:: 4.2 + The ``date_label`` option was introduced in Symfony 4.2. + +Sets the label that will be used when rendering the date widget. Setting it to +``false`` will suppress the label:: + + use Symfony\Component\Form\Extension\Core\Type\DateTimeType; + + $builder->add('startDateTime', DateTimeType::class, array( + 'date_label' => 'Starts On', + )); + date_widget ~~~~~~~~~~~ @@ -144,6 +163,23 @@ this format. .. include:: /reference/forms/types/options/seconds.rst.inc +time_label +~~~~~~~~~~ + +**type**: ``string`` | ``null`` **default**: The label is "guessed" from the field name + +.. versionadded:: 4.2 + The ``time_label`` option was introduced in Symfony 4.2. + +Sets the label that will be used when rendering the time widget. Setting it to +``false`` will suppress the label:: + + use Symfony\Component\Form\Extension\Core\Type\DateTimeType; + + $builder->add('startDateTime', DateTimeType::class, array( + 'time_label' => 'Starts On', + )); + time_widget ~~~~~~~~~~~