aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/datetime.php
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
commitb703d1e8df5e325862ba8cd5f30c693f123b832f (patch)
treeae1f5a6ddf9791d4443077488a03f226a788b52f /phpBB/phpbb/datetime.php
parenta3e910f23f4a2eb079d104dc8bf87b7cbf063daa (diff)
parentbe769d4ca6f3c1a03e6bb4465486a03db6d40b49 (diff)
downloadforums-b703d1e8df5e325862ba8cd5f30c693f123b832f.tar
forums-b703d1e8df5e325862ba8cd5f30c693f123b832f.tar.gz
forums-b703d1e8df5e325862ba8cd5f30c693f123b832f.tar.bz2
forums-b703d1e8df5e325862ba8cd5f30c693f123b832f.tar.xz
forums-b703d1e8df5e325862ba8cd5f30c693f123b832f.zip
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus: [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/datetime.php')
-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']));
+ }
}
}
}