Timezone not preserved from constructor
coatesap opened this issue · comments
Andy Coates commented
In the following code, the timezone parameter seems to get ignored, and all recurrences inherit the system's default timezone (Europe/Paris in this example):
$timezone = new DateTimeZone('Asia/Tokyo');
$recurrence = new \When\When("today 10:00:00", $timezone);
$recurrence
->freq("daily")
->byday("mo,tu,we,th")
->byhour("10,11,12,13,14,15,16,17,18")
->byminute('00')
->bysecond('00')
->count(50)
->generateOccurrences();
var_dump($recurrence->occurrences);
Output:
array (size=9)
0 =>
object(DateTime)[8]
public 'date' => string '2015-08-25 10:00:00' (length=19)
public 'timezone_type' => int 3
public 'timezone' => string 'Europe/Paris' (length=12)
1 =>
object(DateTime)[9]
public 'date' => string '2015-08-25 11:00:00' (length=19)
public 'timezone_type' => int 3
public 'timezone' => string 'Europe/Paris' (length=12)
...
Andy Coates commented
There seems to be a simple fix for this, which I'll submit shortly.