From c3aca37591e1fae5c457518fe23313dd9c4b4036 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Tue, 21 Feb 2023 07:44:34 +0100 Subject: [PATCH] Add the "format_timezone" helper function --- application/helpers/date_helper.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/application/helpers/date_helper.php b/application/helpers/date_helper.php index f30d227f..3f3f4b16 100644 --- a/application/helpers/date_helper.php +++ b/application/helpers/date_helper.php @@ -164,4 +164,24 @@ if ( ! function_exists('format_date_time')) } } +if ( ! function_exists('format_timezone')) +{ + /** + * Format a timezone string based on the current app settings. + * + * @param string $value + * + * @return string + */ + function format_timezone(string $value): string + { + /** @var EA_Controller $CI */ + $CI =& get_instance(); + + $CI->load->library('timezones'); + + return $CI->timezones->get_timezone_name($value); + } +} +