diff --git a/.env.example b/.env.example index 5e78262..23fb9b6 100644 --- a/.env.example +++ b/.env.example @@ -14,5 +14,6 @@ HIDE_APP_FILES=true HIDE_VCS_FILES=true DATE_FORMAT="Y-m-d H:i:s" +TIMEZONE="UTC" MAX_HASH_SIZE=1000000000 diff --git a/app/config/app.php b/app/config/app.php index 07fef6b..5cfaf39 100644 --- a/app/config/app.php +++ b/app/config/app.php @@ -119,6 +119,14 @@ return [ */ 'date_format' => Helpers::env('DATE_FORMAT', 'Y-m-d H:i:s'), + /** + * Default timezone. For a list of supported timezones see: + * https://www.php.net/manual/en/timezones.php + * + * Default value: 'UTC' + */ + 'timezone' => Helpers::env('TIMEZONE', 'UTC'), + /** * The maximum file size (in bytes) that can be hashed. This helps to * prevent timeouts for excessively large files. diff --git a/app/src/Factories/TwigFactory.php b/app/src/Factories/TwigFactory.php index b95aa5e..feef4d9 100644 --- a/app/src/Factories/TwigFactory.php +++ b/app/src/Factories/TwigFactory.php @@ -66,6 +66,10 @@ class TwigFactory $this->container->get('date_format'), '%d days' ); + $twig->getEnvironment()->getExtension(CoreExtension::class)->setTimezone( + $this->container->get('timezone') + ); + foreach (self::VIEW_FUNCTIONS as $function) { $function = $this->callableResolver->resolve($function);