mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for utc offset for task start dates
This commit is contained in:
parent
8e5772e3c1
commit
a7290dd251
@ -880,6 +880,13 @@ class Company extends BaseModel
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function utc_offset(): int
|
||||
{
|
||||
$timezone = $this->timezone();
|
||||
|
||||
return $timezone->utc_offset ?? 0;
|
||||
}
|
||||
|
||||
public function timezone_offset(): int
|
||||
{
|
||||
$offset = 0;
|
||||
|
@ -118,7 +118,7 @@ class TaskRepository extends BaseRepository
|
||||
$task->is_running = $data['is_running'] ? 1 : 0;
|
||||
}
|
||||
|
||||
$task->calculated_start_date = $this->harvestStartDate($time_log);
|
||||
$task->calculated_start_date = $this->harvestStartDate($time_log, $task);
|
||||
|
||||
$task->time_log = json_encode($time_log);
|
||||
|
||||
@ -133,11 +133,11 @@ class TaskRepository extends BaseRepository
|
||||
return $task;
|
||||
}
|
||||
|
||||
private function harvestStartDate($time_log)
|
||||
private function harvestStartDate($time_log, $task)
|
||||
{
|
||||
|
||||
if(isset($time_log[0][0])){
|
||||
return \Carbon\Carbon::createFromTimestamp($time_log[0][0]);
|
||||
return \Carbon\Carbon::createFromTimestamp($time_log[0][0])->addSeconds($task->company->utc_offset());
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -218,7 +218,7 @@ class TaskRepository extends BaseRepository
|
||||
|
||||
$log = array_merge($log, [[$start_time, 0]]);
|
||||
$task->time_log = json_encode($log);
|
||||
$task->calculated_start_date = \Carbon\Carbon::createFromTimestamp($start_time);
|
||||
$task->calculated_start_date = \Carbon\Carbon::createFromTimestamp($start_time)->addSeconds($task->company->utc_offset());
|
||||
|
||||
$task->saveQuietly();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user