-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make time zone for slugs configurable
Slugs of dates are generated during import. This might lead to confusion if the time zone differs from frontend. Therefore the time zone is now configurable to allow adjustments for the actual website. A new interface `TimeZoneProviderInterface` is provided which can be re configured to a different implementation. The default implementation will use TYPO3s `SYS.phpTimeZone` setting, with fall back to `date_default_timezone_get()` call. That way it should be useful for most systems out of the box. Resolves: #11345
- Loading branch information
1 parent
2d6c13e
commit 77d5579
Showing
5 changed files
with
113 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* Copyright (C) 2024 Daniel Siepmann <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
* 02110-1301, USA. | ||
*/ | ||
|
||
namespace WerkraumMedia\Events\Domain\TimeZone; | ||
|
||
use DateTimeZone; | ||
|
||
interface TimeZoneProviderInterface | ||
{ | ||
public function getTimeZone(): DateTimeZone; | ||
} |
36 changes: 36 additions & 0 deletions
36
Classes/Domain/TimeZone/Typo3ConfiguredTimeZoneProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* Copyright (C) 2024 Daniel Siepmann <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
* 02110-1301, USA. | ||
*/ | ||
|
||
namespace WerkraumMedia\Events\Domain\TimeZone; | ||
|
||
use DateTimeZone; | ||
|
||
final class Typo3ConfiguredTimeZoneProvider implements TimeZoneProviderInterface | ||
{ | ||
public function getTimeZone(): DateTimeZone | ||
{ | ||
return new DateTimeZone( | ||
$GLOBALS['TYPO3_CONF_VARS']['SYS']['phpTimeZone'] ?? date_default_timezone_get() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
4.3.0 | ||
===== | ||
|
||
Breaking | ||
-------- | ||
|
||
Nothing | ||
|
||
Features | ||
-------- | ||
|
||
Nothing | ||
|
||
Fixes | ||
----- | ||
|
||
* Make time zone for slugs configurable. | ||
|
||
Slugs of dates are generated during import. | ||
This might lead to confusion if the time zone differs from frontend. | ||
Therefore the time zone is now configurable to allow adjustments for the actual | ||
website. | ||
|
||
A new interface `TimeZoneProviderInterface` is provided which can be re configured to a | ||
different implementation. | ||
|
||
The default implementation will use TYPO3s `SYS.phpTimeZone` setting, with fall | ||
back to `date_default_timezone_get()` call. | ||
That way it should be useful for most systems out of the box. | ||
|
||
Tasks | ||
----- | ||
|
||
Nothing | ||
|
||
Deprecation | ||
----------- | ||
|
||
Nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
'author' => 'Dirk Koritnik, Daniel Siepmann', | ||
'author_email' => '[email protected], [email protected]', | ||
'state' => 'stable', | ||
'version' => '4.2.0', | ||
'version' => '4.2.1', | ||
'constraints' => [ | ||
'depends' => [ | ||
'typo3' => '', | ||
|