Issue Bug Closed

#99627Context:class don't detect timezone correctly

Dieter Porth 01/19/23, 07:54 updated 07/09/24, 12:46

Description

I Define in the LocalConfiguration.php my timezone.
If I want to use the current timezone, I have to use the following code. The commented code will give back the timezone ‘UTC’.

$context = GeneralUtility::makeInstance(Context::class);
$nowStamp = $context->getPropertyFromAspect('date','timestamp');
// $timeZone = $context->getPropertyFromAspect('date','timezone'); // TYPO3 bug
$timeZone = date_default_timezone_get();

Contains the Context:classs a bug?

P.S. I got the idea to use `date_default_timezone_get()` from the f:format.date-viewhelper, which didn`t use the context-class for detecting the timezone. It use the Context:class only for the detection of the current timestamp.

Reviews 6