Mfa: Setting timezone for dates in profile (#43191)

This commit is contained in:
Hannes Papenberg 2024-04-05 11:02:07 +02:00 committed by GitHub
parent aa7a1c7ff0
commit b8d58e7fa8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -127,6 +127,7 @@ class MethodsModel extends BaseDatabaseModel
$utcTimeZone = new \DateTimeZone('UTC');
$jDate = new Date($dateTimeText, $utcTimeZone);
$unixStamp = $jDate->toUnix();
$app = Factory::getApplication();
// I'm pretty sure we didn't have MFA in Joomla back in 1970 ;)
if ($unixStamp < 0) {
@ -135,7 +136,7 @@ class MethodsModel extends BaseDatabaseModel
// I need to display the date in the user's local timezone. That's how you do it.
$user = $this->getCurrentUser();
$userTZ = $user->getParam('timezone', 'UTC');
$userTZ = $user->getParam('timezone', $app->get('offset', 'UTC'));
$tz = new \DateTimeZone($userTZ);
$jDate->setTimezone($tz);