* do not close modal if form is dirty * deprecated TimesheetConfiguration * inject timezone in form types * cleanup usage of UserDateTimeFactory * allow to configure increment steps for minutes * use 15 minutes step for datetimepicker in project edit form * use rounding rules for increments in minute select for begin and end * allow duration in multi user and admin timesheet forms * make dropdown values configurable
32 lines
722 B
PHP
32 lines
722 B
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Kimai time-tracking app.
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace App\Timesheet\TrackingMode;
|
|
|
|
use App\Entity\Timesheet;
|
|
use DateTimeZone;
|
|
|
|
trait TrackingModeTrait
|
|
{
|
|
protected function getTimezone(Timesheet $timesheet): DateTimeZone
|
|
{
|
|
if ($timesheet->getBegin() !== null) {
|
|
return $timesheet->getBegin()->getTimezone();
|
|
}
|
|
|
|
$timezone = date_default_timezone_get();
|
|
|
|
if ($timesheet->getUser() !== null) {
|
|
$timezone = $timesheet->getUser()->getTimezone();
|
|
}
|
|
|
|
return new DateTimeZone($timezone);
|
|
}
|
|
}
|