Skip to content

Commit b8d58e7

Browse files
authored
Mfa: Setting timezone for dates in profile (#43191)
1 parent aa7a1c7 commit b8d58e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

administrator/components/com_users/src/Model/MethodsModel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ public function formatRelative(?string $dateTimeText): string
127127
$utcTimeZone = new \DateTimeZone('UTC');
128128
$jDate = new Date($dateTimeText, $utcTimeZone);
129129
$unixStamp = $jDate->toUnix();
130+
$app = Factory::getApplication();
130131

131132
// I'm pretty sure we didn't have MFA in Joomla back in 1970 ;)
132133
if ($unixStamp < 0) {
@@ -135,7 +136,7 @@ public function formatRelative(?string $dateTimeText): string
135136

136137
// I need to display the date in the user's local timezone. That's how you do it.
137138
$user = $this->getCurrentUser();
138-
$userTZ = $user->getParam('timezone', 'UTC');
139+
$userTZ = $user->getParam('timezone', $app->get('offset', 'UTC'));
139140
$tz = new \DateTimeZone($userTZ);
140141
$jDate->setTimezone($tz);
141142

0 commit comments

Comments
 (0)