use wcf\data\user\option\UserOption;
use wcf\data\user\User;
-use wcf\util\DateUtil;
+use wcf\system\WCF;
/**
* User option output implementation for for the output of a date input.
*/
class DateUserOptionOutput implements IUserOptionOutput
{
- /**
- * date format
- * @var string
- */
- protected $dateFormat = DateUtil::DATE_FORMAT;
-
/**
* @inheritDoc
*/
$date = self::splitDate($value);
- return DateUtil::format(
- DateUtil::getDateTimeByTimestamp(
- \gmmktime(12, 1, 1, $date['month'], $date['day'], $date['year'])
- ),
- $this->dateFormat
+ return \IntlDateFormatter::formatObject(
+ WCF::getUser()->getLocalDate(\gmmktime(12, 1, 1, $date['month'], $date['day'], $date['year'])),
+ [
+ \IntlDateFormatter::LONG,
+ \IntlDateFormatter::NONE,
+ ],
+ WCF::getLanguage()->getLocale()
);
}
$date->modify('-1 day');
self::$periods[$date->getTimestamp()] = WCF::getLanguage()->get('wcf.date.period.yesterday');
+ $formatter = \IntlDateFormatter::create(
+ WCF::getLanguage()->getLocale(),
+ timezone: WCF::getUser()->getTimeZone(),
+ pattern: 'EEEE'
+ );
// 2-6 days back
for ($i = 0; $i < 6; $i++) {
$date->modify('-1 day');
- self::$periods[$date->getTimestamp()] = DateUtil::format($date, 'l');
+ self::$periods[$date->getTimestamp()] = $formatter->format($date);
}
}