mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-04 13:35:13 +02:00
[feature/new-tz-handling] Check the is_short flag stored inside the format array.
Reuse the existing check store in the format array to determine if the date time format supports relative formatting. PHPBB3-9558
This commit is contained in:
parent
8fe46175af
commit
5dd7916c49
@ -73,7 +73,8 @@ class phpbb_datetime extends DateTime
|
||||
public function format($format = '', $force_absolute = false)
|
||||
{
|
||||
$format = $format ? $format : $this->_user->date_format;
|
||||
$relative = (strpos($format, self::RELATIVE_WRAPPER) !== false && !$force_absolute);
|
||||
$format = self::_format_cache($format, $this->_user);
|
||||
$relative = ($format['is_short'] && !$force_absolute);
|
||||
$now = new self('now', $this->_user->tz, $this->_user);
|
||||
|
||||
$timestamp = $this->getTimestamp();
|
||||
@ -114,8 +115,6 @@ class phpbb_datetime extends DateTime
|
||||
|
||||
if ($day !== false)
|
||||
{
|
||||
$format = self::_format_cache($format, $this->_user);
|
||||
|
||||
// Format using the short formatting and finally swap out the relative token placeholder with the correct value
|
||||
return str_replace(self::RELATIVE_WRAPPER . self::RELATIVE_WRAPPER, $this->_user->lang['datetime'][$day], strtr(parent::format($format['format_short']), $format['lang']));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user