app/helpers/account/dates_helper.rb in bullet_train-1.3.1 vs app/helpers/account/dates_helper.rb in bullet_train-1.3.2
- old
+ new
@@ -52,6 +52,19 @@
end
def local_time(timestamp)
timestamp&.in_time_zone(current_user.time_zone)
end
+
+ def am_pm?
+ !"#{I18n.t("time.am", fallback: false, default: "")}#{I18n.t("time.pm", fallback: false, default: "")}".empty?
+ end
+
+ def time_zone_name_to_id
+ ActiveSupport::TimeZone.all.map { |tz| {tz.name.to_s => tz.tzinfo.name} }.reduce({}, :merge)
+ end
+
+ def current_time_zone
+ current_time_zone_name = current_user&.time_zone || current_user&.current_team&.time_zone || "UTC"
+ ActiveSupport::TimeZone.find_tzinfo(current_time_zone_name).name
+ end
end