Index: src/XF/Language.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/XF/Language.php (revision 94c80936bd1eb35605db181b8ec268fea314dc97)
+++ src/XF/Language.php (date 1572954185886)
@@ -627,6 +627,9 @@
{
$timeRef = $this->getDayStartTimestamps();
+ $dateObj = new \DateTime('@' . $timestamp);
+ $dateObj->setTimezone($this->getTimeZone());
+
$interval = $timeRef['now'] - $timestamp;
if ($interval < -2)
@@ -655,20 +658,21 @@
'{time}' => $time
]);
}
- else if ($timestamp < $timeRef['tomorrow'] + 86400)
+ else if ($timestamp < $dateObj->setTimestamp($timeRef['tomorrow'])->modify('+1 day')->format('U')) // day after tomorrow
{
// tomorrow
return strtr($this->getPhraseCacheRaw('tomorrow_at_x'), [
'{time}' => $time
]);
}
- else if ($futureInterval < (7 * 86400))
+ else if ($futureInterval < ($dateObj->setTimestamp(\XF::$time)->modify('+1 week')->format('U') - \XF::$time)) // one week in the future
{
- // after tomorrow
+ // after tomorrow but within the next week
return $this->getDateTimeOutput($date, $time);
}
else if ($getFullDate)
{
+ // more than a week in the future
return $this->getDateTimeOutput($date, $time);
}
else
@@ -705,12 +709,7 @@
}
else if ($timestamp >= $timeRef['week'])
{
- $dow = $timeRef['todayDow'] - ceil(($timeRef['today'] - $timestamp) / 86400);
- if ($dow < 0)
- {
- $dow += 7;
- }
-
+ $dow = $dateObj->setTimestamp($timestamp)->format('w');
$day = $this->getPhraseCacheRaw('day_' . $this->dowTranslation[$dow]);
return strtr($this->getPhraseCacheRaw('day_x_at_time_y'), [