diff options
author | Chris Smith <toonarmy@phpbb.com> | 2010-07-07 22:47:34 +0100 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2012-03-14 22:57:30 -0400 |
commit | 5dd7916c496b76ab2e1e28b804069dde63f7dbf0 (patch) | |
tree | 51c00e5f3cee743bf7ecc36d4f068ef2a20a2162 /phpBB/includes/datetime.php | |
parent | 8fe46175aff1d9275b7337a8ced8060ff850d153 (diff) | |
download | forums-5dd7916c496b76ab2e1e28b804069dde63f7dbf0.tar forums-5dd7916c496b76ab2e1e28b804069dde63f7dbf0.tar.gz forums-5dd7916c496b76ab2e1e28b804069dde63f7dbf0.tar.bz2 forums-5dd7916c496b76ab2e1e28b804069dde63f7dbf0.tar.xz forums-5dd7916c496b76ab2e1e28b804069dde63f7dbf0.zip |
[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
Diffstat (limited to 'phpBB/includes/datetime.php')
-rw-r--r-- | phpBB/includes/datetime.php | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/phpBB/includes/datetime.php b/phpBB/includes/datetime.php index 25da6401d7..ecb3dfcf17 100644 --- a/phpBB/includes/datetime.php +++ b/phpBB/includes/datetime.php @@ -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'])); } |