apply users timezone to toolbar queries (#716)

This commit is contained in:
Kevin Papst
2019-04-22 16:21:22 +02:00
committed by GitHub
parent 46cb021260
commit 215d4fc8bf
11 changed files with 69 additions and 81 deletions

View File

@@ -14,6 +14,7 @@ use App\Export\ServiceExport;
use App\Form\Toolbar\ExportToolbarForm;
use App\Repository\Query\ExportQuery;
use App\Repository\TimesheetRepository;
use App\Timesheet\UserDateTimeFactory;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
@@ -35,15 +36,20 @@ class ExportController extends AbstractController
* @var ServiceExport
*/
protected $export;
/**
* @var UserDateTimeFactory
*/
protected $dateFactory;
/**
* @param TimesheetRepository $timesheet
* @param ServiceExport $export
*/
public function __construct(TimesheetRepository $timesheet, ServiceExport $export)
public function __construct(TimesheetRepository $timesheet, ServiceExport $export, UserDateTimeFactory $dateTime)
{
$this->timesheetRepository = $timesheet;
$this->export = $export;
$this->dateFactory = $dateTime;
}
/**
@@ -52,8 +58,8 @@ class ExportController extends AbstractController
*/
protected function getDefaultQuery()
{
$begin = new \DateTime('first day of this month');
$end = new \DateTime('last day of this month');
$begin = $this->dateFactory->createDateTime('first day of this month 00:00:00');
$end = $this->dateFactory->createDateTime('last day of this month 23:59:59');
$query = new ExportQuery();
$query->setOrder(ExportQuery::ORDER_ASC);