Release 2.0.28 (#4172)

See https://github.com/kimai/kimai/pull/4172
This commit is contained in:
Kevin Papst
2023-07-09 15:27:27 +02:00
committed by GitHub
parent 651f812da8
commit 385753fbc3
27 changed files with 182 additions and 53 deletions

View File

@@ -1174,6 +1174,27 @@ class User implements UserInterface, EquatableInterface, ThemeUserInterface, Pas
return (int) $this->getPreferenceValue(UserPreference::WORK_HOURS_SUNDAY, 0);
}
public function getWorkStartingDay(): ?\DateTimeInterface
{
$date = $this->getPreferenceValue(UserPreference::WORK_STARTING_DAY);
if ($date === null) {
return null;
}
try {
$date = \DateTimeImmutable::createFromFormat('Y-m-d h:i:s', $date . ' 00:00:00', new \DateTimeZone($this->getTimezone()));
} catch (Exception $e) {
}
return ($date instanceof \DateTimeInterface) ? $date : null;
}
public function setWorkStartingDay(?\DateTimeInterface $date): void
{
$this->setPreferenceValue(UserPreference::WORK_STARTING_DAY, $date?->format('Y-m-d'));
}
public function getPublicHolidayGroup(): null|string
{
$group = $this->getPreferenceValue(UserPreference::PUBLIC_HOLIDAY_GROUP);