aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-09-25 11:31:55 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-09-25 18:09:32 +0200
commite803efc6fcad0d49c515ead55eff9a66c6a35cca (patch)
tree56443f70b82fc03211f9f49880d8b748cae20354 /phpBB/phpbb
parent459c62b3399a4e276fb96e97cbbdbd70bd1676b7 (diff)
downloadforums-e803efc6fcad0d49c515ead55eff9a66c6a35cca.tar
forums-e803efc6fcad0d49c515ead55eff9a66c6a35cca.tar.gz
forums-e803efc6fcad0d49c515ead55eff9a66c6a35cca.tar.bz2
forums-e803efc6fcad0d49c515ead55eff9a66c6a35cca.tar.xz
forums-e803efc6fcad0d49c515ead55eff9a66c6a35cca.zip
[ticket/13105] Do not display future dates 2+ days ahead as "tomorrow"
PHPBB3-13105
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/datetime.php39
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']));
+ }
}
}
}