show calculated lockdown date in config screen (#2274)

This commit is contained in:
Kevin Papst
2021-01-20 17:50:50 +01:00
committed by GitHub
parent bd39666759
commit 3cd7e01a2c
2 changed files with 32 additions and 5 deletions

View File

@@ -54,16 +54,15 @@ final class LockdownService
$lockedStart = $this->configuration->getTimesheetLockdownPeriodStart();
$lockedEnd = $this->configuration->getTimesheetLockdownPeriodEnd();
$gracePeriod = $this->configuration->getTimesheetLockdownGracePeriod();
if (!empty($gracePeriod)) {
$gracePeriod = $gracePeriod . ' ';
}
try {
$lockdownStart = new \DateTime($lockedStart, $timesheetStart->getTimezone());
$lockdownEnd = new \DateTime($lockedEnd, $timesheetStart->getTimezone());
$lockdownGrace = new \DateTime($gracePeriod . $lockdownEnd->format('Y-m-d'), $timesheetStart->getTimezone());
$lockdownGrace = clone $lockdownEnd;
if (!empty($gracePeriod)) {
$lockdownGrace->modify($gracePeriod);
}
} catch (\Exception $ex) {
// should not happen, but ... if parsing of datetimes fails: skip validation
return true;