8000 Show example on using a DateTimeImmutable object · symfony/symfony-docs@3bccc62 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3bccc62

Browse files
pavlakisjaviereguiluz
authored andcommitted
Show example on using a DateTimeImmutable object
Add an example on using DateTimeImmutable through the `input` option.
1 parent 56e73bb commit 3bccc62

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

reference/forms/types/date.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ field as **three different choice fields**::
6565
If your underlying date is *not* a ``DateTime`` object (e.g. it's a unix timestamp),
6666
configure the `input`_ option.
6767

68+
When working with a ``DateTimeImmutable`` object, add this as an ``input`` option::
69+
70+
$builder->add('publishedAt', DateType::class, [
71+
'widget' => 'choice',
72+
'input' => 'datetime_immutable'
73+
]);
74+
75+
6876
Rendering a single HTML5 Textbox
6977
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7078

0 commit comments

Comments
 (0)
0