Add ability to set Timezone in config

This commit is contained in:
Micheal Mand
2020-04-13 14:07:15 -06:00
committed by Chris Kankiewicz
parent 5604666253
commit 2bac42522d
3 changed files with 13 additions and 0 deletions

View File

@@ -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

View File

@@ -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.

View File

@@ -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);