mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-17 04:32:15 +01:00
Fixed issue with daylight saving time in chart
This commit is contained in:
@@ -47,22 +47,24 @@ class DashboardService
|
|||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
$windowSize = 24 / $windows;
|
$windowSize = 24 / $windows;
|
||||||
$end = Carbon::now($timeZone)->endOfDay()->subHours(3)->utc()->toDateTimeString();
|
$end = Carbon::now($timeZone)->startOfDay()->addDay()->subHours(3)->utc()->toDateTimeString();
|
||||||
$start = Carbon::now($timeZone)->subDays($days)->startOfDay()->utc()->toDateTimeString();
|
$start = Carbon::now($timeZone)->subDays($days)->startOfDay()->utc()->toDateTimeString();
|
||||||
|
|
||||||
$date = Carbon::now($timeZone)->startOfDay();
|
$date = Carbon::now($timeZone)->startOfDay();
|
||||||
|
$dateUtc = Carbon::now($timeZone)->startOfDay()->utc();
|
||||||
for ($i = 0; $i < $days; $i++) {
|
for ($i = 0; $i < $days; $i++) {
|
||||||
$dateString = $date->format('Y-m-d');
|
$dateString = $date->format('Y-m-d');
|
||||||
$tempDate = $date->copy();
|
$tempDate = $dateUtc->copy();
|
||||||
$start = $tempDate->copy()->utc()->toDateTimeString();
|
$start = $tempDate->copy()->utc()->toDateTimeString();
|
||||||
$tempWindows = [];
|
$tempWindows = [];
|
||||||
for ($j = 0; $j < $windows; $j++) {
|
for ($j = 0; $j < $windows; $j++) {
|
||||||
$tempWindow = $tempDate->utc()->toDateTimeString();
|
$tempWindow = $tempDate->toDateTimeString();
|
||||||
$tempWindows[] = $tempWindow;
|
$tempWindows[] = $tempWindow;
|
||||||
$tempDate->addHours($windowSize);
|
$tempDate->addHours($windowSize);
|
||||||
}
|
}
|
||||||
$result[$dateString] = $tempWindows;
|
$result[$dateString] = $tempWindows;
|
||||||
$date->subDay();
|
$date->subDay();
|
||||||
|
$dateUtc->subDay();
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
Reference in New Issue
Block a user