-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Fix wrong DateTransformer timezone param for non-UTC configuration #12911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@soullivaneuh You could probably base your fix on the tests from #12843. |
@xabbuh ok I will rebase my commit and run this test when it will be merged. |
The options that were used need to be readded too, as it's now a bc break (throwing an option does not exist exception) |
Using Timezone for time doesn't make sense and leads to problems with DST (which was the original issue). So for that we can use UTC as timezone and The problem with the Date and timezone was that you could get the wrong date (for the same reason). Doctrine also warns for storing an timezone specific DateTime in the DB and advises to use UTC as timezone instead. So for Date(Time) we should be able to use the timezone of the user (view) and convert it to UTC in the model. Time is simply something we can't fix without a Date, so using UTC for BC seems like the best compromise. |
Why not implement a single option to determine the timezone to use. It can be set default to null or UTC or date_default_timezone_get(). |
If you set the timezone to null it will use the default |
I sugest this solution (lucagtc@0b3062f). Doctrine (Propel I don't know, but it should be the same) by default create DateTime for date and time field with default timezone, so I'm suggest to leave model_timezone = null. Luca |
ping @webmozart |
The problem is that Doctrine creates DateTime objects with the default timezone in the "time" type but the Form Component assumes UTC in the model, so there's a nice break here. Even I agree that timezones make no sense in time types this is not a subtle change, it should have been done in 3.0 with some coordination with the Doctrine team. +1 for the quick fix! |
Thank you @soullivaneuh. |
…guration (Soullivaneuh) This PR was merged into the 2.6 branch. Discussion ---------- Fix wrong DateTransformer timezone param for non-UTC configuration | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | N/A | Fixed tickets | #12808 | License | MIT | Doc PR | none This PR is a fix of a little mistake on PR #12404. Thanks @mvrhov for the clue! 👍 Pass 'UTC' param cause issue on single_text date type, `null` should be passed to get the default php timezone. Don't know how to add test for #12808 issue, do someone know how to "change" properly timezone during tests? Where can I do this? Thanks. Commits ------- 0104f15 Fix wrong DateTransformer timezone param for non-UTC configuration. #12808
This PR is a fix of a little mistake on PR #12404.
Thanks @mvrhov for the clue! 👍
Pass 'UTC' param cause issue on single_text date type,
null
should be passed to get the default php timezone.Don't know how to add test for #12808 issue, do someone know how to "change" properly timezone during tests? Where can I do this?
Thanks.