Skip to content

Commit

Permalink
Merge pull request #2398 from nextcloud/backport/2397/stable4
Browse files Browse the repository at this point in the history
[stable4] (fix) default timezone for export
  • Loading branch information
Chartman123 authored Nov 6, 2024
2 parents 16762c9 + 2467c91 commit ddb7d8d
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 ddb7d8d

Please sign in to comment.