Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit154145c

Browse files
committed
[Serializer] Add PRESERVE_CONTEXT_TIMEZONE_KEY to DateTimeNormalizer
Adds DateTimeNormalizer::PRESERVE_CONTEXT_TIMEZONE_KEY to the `DateTimeNormalizer` section
1 parent2f3144b commit154145c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎serializer.rst‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,6 +1373,12 @@ normalizers (in order of priority):
13731373
`RFC 3339`_ format. Use ``DateTimeNormalizer::FORMAT_KEY`` and
13741374
``DateTimeNormalizer::TIMEZONE_KEY`` to change the format.
13751375

1376+
To always create:phpclass:`DateTime` and:phpclass:`DateTimeImmutable`
1377+
with the timezone specified in the context, set the
1378+
``DateTimeNormalizer::PRESERVE_CONTEXT_TIMEZONE_KEY`` context option to
1379+
``true``. This will preserve the timezone of the context and ignores any
1380+
timezone from the input.
1381+
13761382
To convert the objects to integers or floats, set the serializer
13771383
context option ``DateTimeNormalizer::CAST_KEY`` to ``int`` or
13781384
``float``.
@@ -1381,6 +1387,10 @@ normalizers (in order of priority):
13811387

13821388
The ``DateTimeNormalizer::CAST_KEY`` context option was introduced in Symfony 7.1.
13831389

1390+
..versionadded::7.3
1391+
1392+
The ``DateTimeNormalizer::PRESERVE_CONTEXT_TIMEZONE_KEY`` context option was introduced in Symfony 7.3.
1393+
13841394
:class:`Symfony\\Component\\Serializer\\Normalizer\\ConstraintViolationListNormalizer`
13851395
This normalizer converts objects that implement
13861396
:class:`Symfony\\Component\\Validator\\ConstraintViolationListInterface`

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp