Fixes for timeshift when offset is negative causing the date to be set the day before

This commit is contained in:
David Bomba 2021-06-25 11:57:17 +10:00
parent f59807d063
commit 0bf29ed65c

View File

@ -428,17 +428,14 @@ class RecurringInvoice extends BaseModel
'due_date' => $next_due_date_string
];
$next_send_date = $this->nextDateByFrequency($next_send_date->format('Y-m-d'));
/* Fixes the timeshift in case the offset is negative which cause a infinite loop due to UTC +0*/
if($this->client->timezone_offset() < 0){
$next_send_date = $this->nextDateByFrequency($next_send_date->addDay()->format('Y-m-d'));
}
else
$next_send_date = $this->nextDateByFrequency($next_send_date->format('Y-m-d'));
}
/*If no due date is set - unset the due_date value */
// if(!$this->due_date_days || $this->due_date_days == 0){
// foreach($data as $key => $value)
// $data[$key]['due_date'] = '';
// }
return $data;
}