mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00: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
1 changed files with 2 additions and 3 deletions
|
@ -73,7 +73,8 @@ class phpbb_datetime extends DateTime
|
||||||
public function format($format = '', $force_absolute = false)
|
public function format($format = '', $force_absolute = false)
|
||||||
{
|
{
|
||||||
$format = $format ? $format : $this->_user->date_format;
|
$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);
|
$now = new self('now', $this->_user->tz, $this->_user);
|
||||||
|
|
||||||
$timestamp = $this->getTimestamp();
|
$timestamp = $this->getTimestamp();
|
||||||
|
@ -114,8 +115,6 @@ class phpbb_datetime extends DateTime
|
||||||
|
|
||||||
if ($day !== false)
|
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
|
// 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']));
|
return str_replace(self::RELATIVE_WRAPPER . self::RELATIVE_WRAPPER, $this->_user->lang['datetime'][$day], strtr(parent::format($format['format_short']), $format['lang']));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue