Fix incidents timezones and order

This commit is contained in:
Joseph Cohen
2015-05-07 09:09:03 -05:00
parent 2712e61ea5
commit 5280fc8df4
3 changed files with 26 additions and 7 deletions

View File

@@ -13,6 +13,7 @@ use CachetHQ\Cachet\Facades\Setting;
use CachetHQ\Segment\Facades\Segment;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Request;
use Jenssegers\Date\Date;
if (!function_exists('set_active')) {
@@ -128,3 +129,20 @@ if (!function_exists('segment_page')) {
}
}
}
if (!function_exists('formatted_date')) {
/**
* Formats a date with the user timezone and the selected format.
*
* @param string $date
*
* @return \Jenssegers\Date\Date
*/
function formatted_date($date)
{
$dateTimeZone = Setting::get('app_timezone');
$dateFormat = Setting::get('date_format') ?: 'jS F Y';
return (new Date($date))->setTimeZone($dateTimeZone)->format($dateFormat);
}
}