diff --git a/Web/Util/DateTime.php b/Web/Util/DateTime.php index b90de19d..991d8032 100644 --- a/Web/Util/DateTime.php +++ b/Web/Util/DateTime.php @@ -1,5 +1,6 @@ timestamp); $now = date_create(); $diff = date_diff($now, $then); + + $sessionOffset = intval(Session::i()->get("_timezoneOffset")); if($diff->invert === 0) return ovk_strftime_safe("%e %B %Y ", $this->timestamp) . tr("time_at_sp") . ovk_strftime_safe(" %R", $this->timestamp); - if($this->timestamp >= strtotime("midnight")) { # Today + if(($this->timestamp + $sessionOffset) >= (strtotime("midnight") + $sessionOffset)) { # Today if($diff->h >= 1) return tr("time_today") . tr("time_at_sp") . ovk_strftime_safe(" %R", $this->timestamp); else if($diff->i < 2) return tr("time_just_now"); else return $diff->i === 5 ? tr("time_exactly_five_minutes_ago") : tr("time_minutes_ago", $diff->i); - } else if($this->timestamp >= strtotime("-1day midnight")) { # Yesterday + } else if(($this->timestamp + $sessionOffset) >= (strtotime("-1day midnight") + $sessionOffset)) { # Yesterday return tr("time_yesterday") . tr("time_at_sp") . ovk_strftime_safe(" %R", $this->timestamp); } else if(ovk_strftime_safe("%Y", $this->timestamp) === ovk_strftime_safe("%Y", time())) { # In this year return ovk_strftime_safe("%e %h ", $this->timestamp) . tr("time_at_sp") . ovk_strftime_safe(" %R", $this->timestamp);