{if $user->isOnline()}
{lang}wcf.user.online{/lang}
<span class="userOnlineIndicator" aria-hidden="true"></span>
- {else}
- {if $columnValues[$user->userID][$column]|isset}{@$columnValues[$user->userID][$column]}{/if}
+ {elseif $user->lastActivityTime}
+ {time time=$user->lastActivityTime}
{/if}
</td>
{else}
use wcf\system\option\user\IUserOptionOutput;
use wcf\system\request\LinkHandler;
use wcf\system\WCF;
-use wcf\util\DateUtil;
use wcf\util\StringUtil;
/**
break;
case 'registrationDate':
- $this->columnValues[$user->userID][$column] = DateUtil::format(
- DateUtil::getDateTimeByTimestamp($user->{$column}),
- DateUtil::DATE_FORMAT
+ $this->columnValues[$user->userID][$column] = \IntlDateFormatter::formatObject(
+ WCF::getUser()->getLocalDate($user->{$column}),
+ [
+ \IntlDateFormatter::LONG,
+ \IntlDateFormatter::NONE,
+ ],
+ WCF::getLanguage()->getLocale()
);
break;
- case 'lastActivityTime':
- if ($user->{$column}) {
- $this->columnValues[$user->userID][$column] = \str_replace(
- '%time%',
- DateUtil::format(
- DateUtil::getDateTimeByTimestamp($user->{$column}),
- DateUtil::TIME_FORMAT
- ),
- \str_replace(
- '%date%',
- DateUtil::format(
- DateUtil::getDateTimeByTimestamp($user->{$column}),
- DateUtil::DATE_FORMAT
- ),
- WCF::getLanguage()->get('wcf.date.dateTimeFormat')
- )
- );
- }
- break;
-
case 'profileHits':
case 'activityPoints':
case 'likesReceived':
use wcf\system\bbcode\SimpleMessageParser;
use wcf\system\exception\NotImplementedException;
use wcf\system\WCF;
-use wcf\util\DateUtil;
use wcf\util\OptionUtil;
use wcf\util\StringUtil;
$day = \intval($optionValue[2]);
}
- return DateUtil::format(
- DateUtil::getDateTimeByTimestamp(\gmmktime(12, 1, 1, $month, $day, $year)),
- DateUtil::DATE_FORMAT
+ return \IntlDateFormatter::formatObject(
+ WCF::getUser()->getLocalDate(\gmmktime(12, 1, 1, $month, $day, $year)),
+ [
+ \IntlDateFormatter::LONG,
+ \IntlDateFormatter::NONE,
+ ],
+ WCF::getLanguage()->getLocale()
);
case 'float':
return $this->timezoneObj;
}
+ /**
+ * Applies the user's timezone to the given timestamp.
+ */
+ public function getLocalDate(int $timestamp): \DateTimeImmutable
+ {
+ $dateTime = (new \DateTimeImmutable('@' . $timestamp));
+ $dateTime = $dateTime->setTimezone($this->getTimeZone());
+
+ return $dateTime;
+ }
+
/**
* Returns a list of users.
*