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

[FrameworkBundle] Add theclock.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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@alexandre-daubois
Copy link
Member

@alexandre-dauboisalexandre-daubois commentedOct 2, 2024
edited
Loading

QA
Branch?7.2
Bug fix?no
New feature?yes
Deprecations?no
Issues-
LicenseMIT

We are introducing the clock component in a project. Because of legacy reasons, dates are stored using theEurope/Paris timezone instead of using UTC. Because we'd like to use theclock service and theClockAwareTrait, it would be nice to configure the timezone to use right in the framework configuration, under a new option calledclock.default_timezone:

framework:clock:default_timezone:Europe/Paris

This adds more flexibility to developers to configure the default timezone to use. Even if the clock gets a default timezone usingdate_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.

kaznovac reacted with thumbs up emoji
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment
edited
Loading

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 aphp.ini file at the root of your app. That's a better alternative to me.

}

try {
returnnew \DateTimeZone($v);

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

alexandre-daubois reacted with eyes emoji
@javiereguiluzjaviereguiluz added the ❄️ Feature FreezeImportant Pull Requests to finish before the next Symfony "feature freeze" labelOct 3, 2024
@alexandre-daubois
Copy link
MemberAuthor

I understand, maybe this option could come with a warning in the->info() part about it? My use case is that we have several (legacy or not) project running with the samephp.ini in our team. This option would allow to configure a timezone at the framework level only in thedev env, for example. This way, we don't have to touch thephp.ini file that works great with the other projects when running multiple projects on the same machine.

However, I understand your point of view about omitting the option inphp.ini. This could be indicated in the explanation of the option?

@nicolas-grekas
Copy link
Member

I'd say you need to improve your dev stack: eg if you usesymfony serve, php.ini in the root of the app is also loaded. Just use it :)

@alexandre-daubois
Copy link
MemberAuthor

I wasn't aware of this feature. Indeed, that's way better. Let's close then, thanks!

@alexandre-daubois
Copy link
MemberAuthor

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 🙂

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@stofstofstof left review comments

@OskarStarkOskarStarkOskarStark approved these changes

Assignees

No one assigned

Labels

FeatureFrameworkBundle❄️ Feature FreezeImportant Pull Requests to finish before the next Symfony "feature freeze"Status: Reviewed

Projects

None yet

Milestone

7.2

Development

Successfully merging this pull request may close these issues.

6 participants

@alexandre-daubois@nicolas-grekas@stof@OskarStark@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp