Skip to content

Commit

Permalink
Merge pull request #2397 from AIlkiv/default-timezone-for-export-date
Browse files Browse the repository at this point in the history
(fix) default timezone for export
  • Loading branch information
Chartman123 authored Nov 6, 2024
2 parents 1bd6ef3 + cb611e8 commit 39bd5df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Service/SubmissionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function getSubmissionsData(Form $form, string $fileFormat, ?File $file =
$submissionEntities = array_reverse($submissionEntities);

$questions = $this->questionMapper->findByForm($form->getId());
$defaultTimeZone = date_default_timezone_get();
$defaultTimeZone = $this->config->getSystemValueString('default_timezone', 'UTC');

if (!$this->currentUser) {
$userTimezone = $this->config->getUserValue($form->getOwnerId(), 'core', 'timezone', $defaultTimeZone);
Expand Down
6 changes: 5 additions & 1 deletion tests/Unit/Service/SubmissionServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,11 @@ private function setUpCsvTest(array $questions, array $submissions, string $csvT
return $questionEntities;
}));

date_default_timezone_set('Europe/Berlin');
$this->config->expects($this->once())
->method('getSystemValueString')
->with('default_timezone', 'UTC')
->willReturn('Europe/Berlin');

$this->config->expects($this->once())
->method('getUserValue')
->with('currentUser', 'core', 'timezone', 'Europe/Berlin')
Expand Down

0 comments on commit 39bd5df

Please sign in to comment.