From 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 18 Nov 2021 13:16:36 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-5-stable-ee --- app/helpers/time_zone_helper.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app/helpers/time_zone_helper.rb') diff --git a/app/helpers/time_zone_helper.rb b/app/helpers/time_zone_helper.rb index a0d9c8403e8..db355f5ff65 100644 --- a/app/helpers/time_zone_helper.rb +++ b/app/helpers/time_zone_helper.rb @@ -32,10 +32,16 @@ module TimeZoneHelper end end + def local_time_instance(timezone) + return Time.zone if timezone.blank? + + ActiveSupport::TimeZone.new(timezone) || Time.zone + end + def local_time(timezone) return if timezone.blank? - time_zone_instance = ActiveSupport::TimeZone.new(timezone) || Time.zone + time_zone_instance = local_time_instance(timezone) time_zone_instance.now.strftime("%-l:%M %p") end end -- cgit v1.2.3