Skip to content

Commit 122fb7b

Browse files
committed
minor #10962 Show example on using a DateTimeImmutable object (pavlakis)
This PR was submitted for the 4.2 branch but it was merged into the 3.4 branch instead (closes #10962). Discussion ---------- Show example on using a DateTimeImmutable object Add an example on using DateTimeImmutable through the `input` option. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- 3bccc62 Show example on using a DateTimeImmutable object
2 parents 56e73bb + 3bccc62 commit 122fb7b

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)