Skip to content
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

Setting timezone dynamically #328

Open
ghost opened this issue Oct 14, 2020 · 4 comments
Open

Setting timezone dynamically #328

ghost opened this issue Oct 14, 2020 · 4 comments

Comments

@ghost
Copy link

ghost commented Oct 14, 2020

Hi there,
Is there a way to set timezone dynamically in crunz?
We read timezone from a php configuration file.

Thanks.

@PabloKowalczyk
Copy link
Collaborator

Hello,

currently you can set it per task using timezone method.
With env vars support (#315) you can set it by env var, but event better will be to support PHP config file where you can do everything you want. WDYT?

@ghost
Copy link
Author

ghost commented Oct 21, 2020

@PabloKowalczyk I think its better if we can also do $schedule>timezone() at the beginning of each task file.
Also, thank you for your awesome library, saved me a big time.

@vicphase
Copy link

@PabloKowalczyk how can I invoice the timezone method?

@PabloKowalczyk
Copy link
Collaborator

@vmartinez56 you can specify timezone per task:

<?php

use Crunz\Schedule;

$schedule = new Schedule();
$task = $schedule->run(PHP_BINARY, ['-v']);
$task
    ->everyMinute()
    ->timezone('Europe/Warsaw') // string or \DateTimeZone instance
;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants