app/models/mr_common/timezone.rb in mr_common-1.3.0 vs app/models/mr_common/timezone.rb in mr_common-2.0.0
- old
+ new
@@ -1,13 +1,18 @@
# frozen_string_literal: true
module MrCommon
+ # Helper class for building time zone select options. Pares down the list by
+ # grouping locations that share ones or offsets.
class Timezone
class << self
+ # @return [Array<String>] list of time zone names ordered by offset
def time_zone_options
filtered_time_zones.collect(&:name)
end
+ # @return [Array<Array<String, String>>] list of label value pairs for
+ # building time zone select options ordered by offset.
def time_zone_select_options
filtered_time_zones.collect do |tz|
["(UTC#{tz_utc_offset(tz)}) #{tz_friendly_name(tz)}", tz.name]
end
end