fix timezone problems in timesheet forms (#555)

This commit is contained in:
Kevin Papst
2019-02-13 21:37:54 +01:00
committed by GitHub
parent 2c6f57c7ce
commit ef33233624
23 changed files with 461 additions and 61 deletions

View File

@@ -12,6 +12,7 @@ namespace App\Export\Renderer;
use App\Entity\Timesheet;
use App\Export\RendererInterface;
use App\Repository\Query\TimesheetQuery;
use App\Timesheet\UserDateTimeFactory;
use Mpdf\Mpdf;
use Mpdf\Output\Destination;
use Symfony\Component\HttpFoundation\Response;
@@ -27,11 +28,18 @@ class PDFRenderer implements RendererInterface
protected $twig;
/**
* @param \Twig_Environment $twig
* @var UserDateTimeFactory
*/
public function __construct(\Twig_Environment $twig)
protected $dateTime;
/**
* @param \Twig_Environment $twig
* @param UserDateTimeFactory $dateTime
*/
public function __construct(\Twig_Environment $twig, UserDateTimeFactory $dateTime)
{
$this->twig = $twig;
$this->dateTime = $dateTime;
}
/**
@@ -48,7 +56,7 @@ class PDFRenderer implements RendererInterface
$content = $this->twig->render('export/renderer/pdf.html.twig', [
'entries' => $timesheets,
'query' => $query,
'now' => new \DateTime(),
'now' => $this->dateTime->createDateTime(),
'summaries' => $this->calculateSummary($timesheets),
]);