crunzphp / crunz

A PHP-based job scheduler
MIT License
176 stars 16 forks source link

Task Life Time functions don't respect the timezone #62

Closed CerealP0rt closed 10 months ago

CerealP0rt commented 11 months ago

Crunz version: 3.4.1

PHP version: 8.2.8

Description
The timezone setting in crunz.yml is ignored for task life time checks in https://github.com/crunzphp/crunz/blob/v3.4.1/src/Event.php#L1191-L1213 . This causes tasks to run outside of specified time ranges.

How to reproduce
Have date.timezone=UTC in your php.ini and timezone: Europe/Berlin in your crunz.yml

crunz task:

<?php

use Crunz\Schedule;

$scheduler = new Schedule();
$scheduler
    ->run('echo "Hello World!"')
    ->everyMinute()
    ->between('12:00', '20:00');

return $scheduler;

play around with values for between and observe that it is following UTC times and not Europe/Berlin as configured.

PabloKowalczyk commented 10 months ago

Hello @CerealP0rt, does https://github.com/crunzphp/crunz/pull/71 fixes your issue?

CerealP0rt commented 10 months ago

It does, thank you very much.

PabloKowalczyk commented 10 months ago

Fixed in https://github.com/crunzphp/crunz/releases/tag/v3.5.1