Skip to content

Commit

Permalink
Mfa: Setting timezone for dates in profile (#43191)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackwar committed Apr 5, 2024
1 parent aa7a1c7 commit b8d58e7
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -127,6 +127,7 @@ public function formatRelative(?string $dateTimeText): string
$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) {
Expand All @@ -135,7 +136,7 @@ public function formatRelative(?string $dateTimeText): string

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

Expand Down

0 comments on commit b8d58e7

Please sign in to comment.