fix first week in year shows wrong year (#2239)
This commit is contained in:
@@ -51,7 +51,7 @@ class DateTimeFactory
|
||||
$date = $this->createDateTime('now');
|
||||
}
|
||||
|
||||
return $this->createWeekDateTime($date->format('Y'), $date->format('W'), 1, 0, 0, 0);
|
||||
return $this->createWeekDateTime($date->format('o'), $date->format('W'), 1, 0, 0, 0);
|
||||
}
|
||||
|
||||
public function getEndOfWeek(?DateTime $date = null): DateTime
|
||||
@@ -60,7 +60,7 @@ class DateTimeFactory
|
||||
$date = $this->createDateTime('now');
|
||||
}
|
||||
|
||||
return $this->createWeekDateTime($date->format('Y'), $date->format('W'), 7, 23, 59, 59);
|
||||
return $this->createWeekDateTime($date->format('o'), $date->format('W'), 7, 23, 59, 59);
|
||||
}
|
||||
|
||||
public function getEndOfMonth(): DateTime
|
||||
|
||||
@@ -27,7 +27,7 @@ final class PaginatedWorkingTimeChart extends SimpleWidget implements UserWidget
|
||||
$this->setTitle('stats.yourWorkingHours');
|
||||
|
||||
$this->setOptions([
|
||||
'year' => (new DateTime('now'))->format('Y'),
|
||||
'year' => (new DateTime('now'))->format('o'),
|
||||
'week' => (new DateTime('now'))->format('W'),
|
||||
'type' => 'bar',
|
||||
]);
|
||||
@@ -38,7 +38,7 @@ final class PaginatedWorkingTimeChart extends SimpleWidget implements UserWidget
|
||||
$this->setOption('user', $user);
|
||||
$now = new DateTime('now', new \DateTimeZone($user->getTimezone()));
|
||||
$this->setOptions([
|
||||
'year' => $now->format('Y'),
|
||||
'year' => $now->format('o'),
|
||||
'week' => $now->format('W'),
|
||||
]);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ final class PaginatedWorkingTimeChart extends SimpleWidget implements UserWidget
|
||||
|
||||
$thisMonth = clone $weekBegin;
|
||||
if ((int) $options['week'] === 1) {
|
||||
$thisMonth = (new DateTime())->setISODate($options['year'], $options['week'], 7)->setTime(0, 0, 0);
|
||||
$thisMonth = (new DateTime('now', $timezone))->setISODate($options['year'], $options['week'], 7)->setTime(0, 0, 0);
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user