mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-12 02:02:15 +01:00
Fixed timezones in detailed export reports
This commit is contained in:
@@ -6,6 +6,7 @@ namespace App\Service\ReportExport;
|
||||
|
||||
use App\Models\TimeEntry;
|
||||
use App\Service\IntervalService;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
@@ -29,6 +30,15 @@ class TimeEntriesDetailedCsvExport extends CsvExport
|
||||
|
||||
protected const string CARBON_FORMAT = 'Y-m-d H:i:s';
|
||||
|
||||
private string $timezone;
|
||||
|
||||
public function __construct(string $disk, string $folderPath, string $filename, Builder $builder, int $chunk, string $timezone)
|
||||
{
|
||||
parent::__construct($disk, $folderPath, $filename, $builder, $chunk);
|
||||
|
||||
$this->timezone = $timezone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TimeEntry $model
|
||||
*/
|
||||
@@ -43,8 +53,8 @@ class TimeEntriesDetailedCsvExport extends CsvExport
|
||||
'Project' => $model->project?->name,
|
||||
'Client' => $model->client?->name,
|
||||
'User' => $model->user->name,
|
||||
'Start' => $model->start,
|
||||
'End' => $model->end,
|
||||
'Start' => $model->start->timezone($this->timezone),
|
||||
'End' => $model->end->timezone($this->timezone),
|
||||
'Duration' => $duration !== null ? $interval->format($model->getDuration()) : null,
|
||||
'Duration (decimal)' => $duration?->totalHours,
|
||||
'Billable' => $model->billable ? 'Yes' : 'No',
|
||||
|
||||
Reference in New Issue
Block a user