1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Merge pull request #2841 from cab2753/2839-timezone-fix

Respect user's timezone in Utils::dateToString().
This commit is contained in:
Hillel Coren 2019-05-21 11:43:10 +03:00 committed by GitHub
commit fcf846d530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -752,9 +752,10 @@ class Utils
} }
$timestamp = $dateTime->getTimestamp(); $timestamp = $dateTime->getTimestamp();
$timezone = Session::get(SESSION_TIMEZONE, DEFAULT_TIMEZONE);
$format = Session::get(SESSION_DATE_FORMAT, DEFAULT_DATE_FORMAT); $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) public static function timestampToString($timestamp, $timezone, $format)
@ -929,7 +930,7 @@ class Utils
return 0; return 0;
} }
public static function getDateMonth($offset, $locale) public static function getDateMonth($offset, $locale)
{ {
$timestamp = time(); $timestamp = time();
$res = $timestamp + ($offset * 24 * 60 * 60); $res = $timestamp + ($offset * 24 * 60 * 60);
@ -946,7 +947,7 @@ class Utils
return trans('texts.' . $months[$month], [], $locale); return trans('texts.' . $months[$month], [], $locale);
} }
public static function getDateYear($offset) public static function getDateYear($offset)
{ {
$timestamp = time(); $timestamp = time();
$res = $timestamp + ($offset * 24 * 60 * 60); $res = $timestamp + ($offset * 24 * 60 * 60);