[Serializer] Add PRESERVE_CONTEXT_TIMEZONE_KEY to DateTimeNormalizer#20860
Open
frankdekker wants to merge 3 commits intosymfony:7.3from
Open
[Serializer] Add PRESERVE_CONTEXT_TIMEZONE_KEY to DateTimeNormalizer#20860frankdekker wants to merge 3 commits intosymfony:7.3from
PRESERVE_CONTEXT_TIMEZONE_KEY to DateTimeNormalizer#20860frankdekker wants to merge 3 commits intosymfony:7.3from
Conversation
PRESERVE_CONTEXT_TIMEZONE_KEY to DateTimeNormalizer
Adds DateTimeNormalizer::PRESERVE_CONTEXT_TIMEZONE_KEY to the `DateTimeNormalizer` section
- Updated docs to updated const
nicolas-grekas
added a commit
to symfony/symfony
that referenced
this pull request
Nov 1, 2025
…izer` during denormalization (frankdekker) This PR was squashed before being merged into the 7.4 branch. Discussion ---------- [Serializer] Allow forcing timezone in `DateTimeNormalizer` during denormalization | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | Fix #59807 | License | MIT By default the `DateTimeNormalizer` will denormalize timestamps and date strings that include a timezone to `DateTime` objects with respective timezone UTC or the timezone from the date string. Even with the context key `TIMEZONE_KEY` set, the timezone from the input superceeds the context timezone. This PR allows to set `PRESERVE_CONTEXT_TIMEZONE_KEY` context to `true` (default: `false`), which in combination with `TIMEZONE_KEY` will set the Timezone of the denormalized DateTimes to the given timezone. The timezone from the input will be overwritten. ### Documentation symfony/symfony-docs#20860 Commits ------- bd1a4d0 [Serializer] Allow forcing timezone in `DateTimeNormalizer` during denormalization
mdriessen
reviewed
Nov 1, 2025
Change version to 7.4 Co-authored-by: Matty Driessen <mdriessen@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds DateTimeNormalizer::PRESERVE_CONTEXT_TIMEZONE_KEY to the
DateTimeNormalizersectionDocumentation for:
DateTimeNormalizerduring denormalization symfony#60153