Skip to content

Commit 10ae72f

Browse files
committed
Fixes the problem that the user's time zone is not used
See #6042 (comment)
1 parent 865e027 commit 10ae72f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

wcfsetup/install/files/lib/system/template/plugin/DateModifierTemplatePlugin.class.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@ class DateModifierTemplatePlugin implements IModifierTemplatePlugin
2929
public function execute($tagArgs, TemplateEngine $tplObj)
3030
{
3131
if ($tagArgs[0] instanceof \DateTimeInterface) {
32-
$dateTime = $tagArgs[0];
32+
$dateTime = clone $tagArgs[0];
3333
} else {
3434
$timestamp = \intval($tagArgs[0]);
3535
$dateTime = new \DateTimeImmutable('@' . $timestamp);
3636
}
3737

3838
if (!empty($tagArgs[1])) {
39-
return $dateTime->format($tagArgs[1]);
39+
return $dateTime
40+
->setTimezone(WCF::getUser()->getTimeZone())
41+
->format($tagArgs[1]);
4042
} else {
4143
$locale = WCF::getLanguage()->getLocale();
4244
$timeZone = WCF::getUser()->getTimeZone();

0 commit comments

Comments
 (0)