aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2014-09-25 21:52:53 +0200
committerAndreas Fischer <bantu@phpbb.com>2014-09-25 21:52:53 +0200
commitbe769d4ca6f3c1a03e6bb4465486a03db6d40b49 (patch)
tree6f738a91855a9114f3482b1d073dbde0ae5216dc /phpBB/phpbb
parente802c5f08237324bc7245340ea9e6bdf7abd276a (diff)
parente803efc6fcad0d49c515ead55eff9a66c6a35cca (diff)
downloadforums-be769d4ca6f3c1a03e6bb4465486a03db6d40b49.tar
forums-be769d4ca6f3c1a03e6bb4465486a03db6d40b49.tar.gz
forums-be769d4ca6f3c1a03e6bb4465486a03db6d40b49.tar.bz2
forums-be769d4ca6f3c1a03e6bb4465486a03db6d40b49.tar.xz
forums-be769d4ca6f3c1a03e6bb4465486a03db6d40b49.zip
Merge pull request #2995 from nickvergessen/ticket/13105
[ticket/13105] Future relative dates are always displayed as "Tomorrow" * nickvergessen/ticket/13105: [ticket/13105] Do not display future dates 2+ days ahead as "tomorrow" [ticket/13105] Add a test for relative dates
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']));
+ }
}
}
}