From 904cff732c42d53703e436703318324c8650d280 Mon Sep 17 00:00:00 2001 From: cab2753 Date: Mon, 20 May 2019 18:35:30 -0700 Subject: [PATCH] Respect user's timezone in Utils::dateToString(). --- app/Libraries/Utils.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index 34e70ec2f2..121e3cc5d6 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -752,9 +752,10 @@ class Utils } $timestamp = $dateTime->getTimestamp(); + $timezone = Session::get(SESSION_TIMEZONE, DEFAULT_TIMEZONE); $format = Session::get(SESSION_DATE_FORMAT, DEFAULT_DATE_FORMAT); - return self::timestampToString($timestamp, false, $format); + return self::timestampToString($timestamp, $timezone, $format); } public static function timestampToString($timestamp, $timezone, $format) @@ -929,7 +930,7 @@ class Utils return 0; } - public static function getDateMonth($offset, $locale) + public static function getDateMonth($offset, $locale) { $timestamp = time(); $res = $timestamp + ($offset * 24 * 60 * 60); @@ -946,7 +947,7 @@ class Utils return trans('texts.' . $months[$month], [], $locale); } - public static function getDateYear($offset) + public static function getDateYear($offset) { $timestamp = time(); $res = $timestamp + ($offset * 24 * 60 * 60);