allow to configure timezone for the lockdown period (#2593)

This commit is contained in:
Kevin Papst
2021-06-02 00:05:44 +02:00
committed by GitHub
parent c1eb5ba90a
commit 286b63e2c8
16 changed files with 163 additions and 41 deletions

View File

@@ -55,10 +55,17 @@ final class LockdownService
$lockedStart = $this->configuration->getTimesheetLockdownPeriodStart();
$lockedEnd = $this->configuration->getTimesheetLockdownPeriodEnd();
$gracePeriod = $this->configuration->getTimesheetLockdownGracePeriod();
$timezone = $this->configuration->getTimesheetLockdownTimeZone();
if ($timezone === null) {
$timezone = $timesheetStart->getTimezone();
} else {
$timezone = new \DateTimeZone($timezone);
}
try {
$lockdownStart = new \DateTime($lockedStart, $timesheetStart->getTimezone());
$lockdownEnd = new \DateTime($lockedEnd, $timesheetStart->getTimezone());
$lockdownStart = new \DateTime($lockedStart, $timezone);
$lockdownEnd = new \DateTime($lockedEnd, $timezone);
$lockdownGrace = clone $lockdownEnd;
if (!empty($gracePeriod)) {
$lockdownGrace->modify($gracePeriod);