1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for timeshift offsets when offset is negative

This commit is contained in:
David Bomba 2021-06-25 12:20:08 +10:00
parent 0bf29ed65c
commit fd81ac4ea3

View File

@ -224,6 +224,13 @@ class RecurringInvoice extends BaseModel
$offset = $this->client->timezone_offset();
/*
As we are firing at UTC+0 if our offset is negative it is technically firing the day before so we always need
to add ON a day - a day = 86400 seconds
*/
if($offset < 0)
$offset += 86400;
switch ($this->frequency_id) {
case self::FREQUENCY_DAILY:
return Carbon::parse($this->next_send_date)->startOfDay()->addDay()->addSeconds($offset);