namespace wcf\system\template\plugin;
use wcf\system\template\TemplateEngine;
+use wcf\system\WCF;
use wcf\util\DateUtil;
/**
$dateTime = new \DateTimeImmutable('@' . $timestamp);
}
- return DateUtil::format(
- $dateTime,
- (!empty($tagArgs[1]) ? $tagArgs[1] : DateUtil::DATE_FORMAT)
- );
+ if (!empty($tagArgs[1])) {
+ return DateUtil::format(
+ $dateTime,
+ $tagArgs[1]
+ );
+ } else {
+ return \IntlDateFormatter::create(
+ WCF::getLanguage()->getLocale(),
+ \IntlDateFormatter::LONG,
+ \IntlDateFormatter::NONE,
+ WCF::getUser()->getTimeZone()
+ )->format($dateTime);
+ }
}
}
use wcf\system\template\TemplateEngine;
use wcf\system\WCF;
-use wcf\util\DateUtil;
/**
* Template modifier plugin which renders a \DateTimeInterface or
$dateTime = new \DateTimeImmutable('@' . $timestamp);
}
- return \str_replace(
- '%time%',
- DateUtil::format($dateTime, DateUtil::TIME_FORMAT),
- \str_replace(
- '%date%',
- DateUtil::format($dateTime, DateUtil::DATE_FORMAT),
- WCF::getLanguage()->get('wcf.date.dateTimeFormat')
- )
- );
+ return \IntlDateFormatter::create(
+ WCF::getLanguage()->getLocale(),
+ \IntlDateFormatter::LONG,
+ \IntlDateFormatter::SHORT,
+ WCF::getUser()->getTimeZone()
+ )->format($dateTime);
}
}