diff options
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/datetime.php | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/phpBB/phpbb/datetime.php b/phpBB/phpbb/datetime.php index e674707883..63cdba90fd 100644 --- a/phpBB/phpbb/datetime.php +++ b/phpBB/phpbb/datetime.php @@ -91,25 +91,28 @@ class datetime extends \DateTime $midnight = $midnight->getTimestamp(); - $day = false; - - if ($timestamp > $midnight + 86400) - { - $day = 'TOMORROW'; - } - else if ($timestamp > $midnight) - { - $day = 'TODAY'; - } - else if ($timestamp > $midnight - 86400) - { - $day = 'YESTERDAY'; - } - - if ($day !== false) + if ($timestamp <= $midnight + 2 * 86400) { - // 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'])); + $day = false; + + if ($timestamp > $midnight + 86400) + { + $day = 'TOMORROW'; + } + else if ($timestamp > $midnight) + { + $day = 'TODAY'; + } + else if ($timestamp > $midnight - 86400) + { + $day = 'YESTERDAY'; + } + + if ($day !== false) + { + // 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'])); + } } } } |