mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 08:12:17 +01:00
Fixed timezone issue in timentry index endpoint
This commit is contained in:
committed by
Constantin Graf
parent
4242b23ada
commit
fccd57a3f3
@@ -17,6 +17,7 @@ use App\Service\TimezoneService;
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -53,11 +54,11 @@ class TimeEntryController extends Controller
|
||||
->orderBy('start', 'desc');
|
||||
|
||||
if ($request->has('before')) {
|
||||
$timeEntriesQuery->whereDate('start', '<', $request->input('before'));
|
||||
$timeEntriesQuery->where('start', '<', Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $request->input('before'), 'UTC'));
|
||||
}
|
||||
|
||||
if ($request->has('after')) {
|
||||
$timeEntriesQuery->whereDate('start', '>', $request->input('after'));
|
||||
$timeEntriesQuery->where('start', '>', Carbon::createFromFormat('Y-m-d\TH:i:s\Z', $request->input('after'), 'UTC'));
|
||||
}
|
||||
|
||||
if ($request->has('active')) {
|
||||
@@ -105,7 +106,8 @@ class TimeEntryController extends Controller
|
||||
]);
|
||||
$timeEntries = $timeEntriesQuery
|
||||
->limit(5000)
|
||||
->whereDate('start', '=', $lastDate->toDateString())
|
||||
->where('start', '>=', $lastDate->copy()->startOfDay()->utc())
|
||||
->where('start', '<=', $lastDate->copy()->endOfDay()->utc())
|
||||
->get();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user