-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[FrameworkBundle] Add the clock.default_timezone option
#58434
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
[FrameworkBundle] Add the clock.default_timezone option
#58434
Conversation
1bffa55 to
dbc185a
Compare
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
dbc185a to
8caa882
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To challenge this: not setting the ini option while setting the config option might create discrepancies between parts that use the time without getting through the clock component. Not sure this is a win. Having better control of ini settings might be preferable. When using Platform.sh for example, you can commit a php.ini file at the root of your app. That's a better alternative to me.
| } | ||
|
|
||
| try { | ||
| return new \DateTimeZone($v); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this validation logic prevents using env vars for configuring the option
|
I understand, maybe this option could come with a warning in the However, I understand your point of view about omitting the option in |
|
I'd say you need to improve your dev stack: eg if you use |
|
I wasn't aware of this feature. Indeed, that's way better. Let's close then, thanks! |
|
Thanks for this feedback @ro0NL, would this PR solve your issue? Could you maybe elaborate a bit on how this would help you if possible? I'd be happy to reopen if relevant 🙂 |
We are introducing the clock component in a project. Because of legacy reasons, dates are stored using the
Europe/Paristimezone instead of using UTC. Because we'd like to use theclockservice and theClockAwareTrait, it would be nice to configure the timezone to use right in the framework configuration, under a new option calledclock.default_timezone:This adds more flexibility to developers to configure the default timezone to use. Even if the clock gets a default timezone using
date_default_timezone_get(), having the possibility to set this option would remove some magic. More than that, it makes the clock service consistent across different PHP installation that may have any value in theirphp.ini.