From a0732496de8a42ba9123a1bd0cdc11ec7aaab5fb Mon Sep 17 00:00:00 2001 From: Adoni Pavlakis Date: Sun, 3 Feb 2019 20:48:32 +0000 Subject: [PATCH] Show example on using a DateTimeImmutable object Add an example on using DateTimeImmutable through the `input` option. --- reference/forms/types/date.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst index 3ed4afdba96..b47650f6f30 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -69,6 +69,14 @@ field as **three different choice fields**:: If your underlying date is *not* a ``DateTime`` object (e.g. it's a unix timestamp), configure the `input`_ option. +When working with a ``DateTimeImmutable`` object, add this as an ``input`` option:: + + $builder->add('publishedAt', DateType::class, [ + 'widget' => 'choice', + 'input' => 'datetime_immutable' + ]); + + Rendering a single HTML5 Textbox ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~