aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/inputs/full_time_zone_input.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/inputs/full_time_zone_input.rb b/app/inputs/full_time_zone_input.rb
index f5d8a9ba2..b3f43fa19 100644
--- a/app/inputs/full_time_zone_input.rb
+++ b/app/inputs/full_time_zone_input.rb
@@ -1,7 +1,13 @@
class FullTimeZoneInput < SimpleForm::Inputs::CollectionSelectInput
def collection
@collection ||= begin
- collection = options.delete(:collection) || ActiveSupport::TimeZone::MAPPING
+ collection = options.delete(:collection) || begin
+ coll = ActiveSupport::TimeZone::MAPPING.invert
+ coll.sort_by do |k, v|
+ tz = ActiveSupport::TimeZone[k]
+ "(#{tz.formatted_offset}) #{tz.name}"
+ end
+ end
collection.respond_to?(:call) ? collection.call : collection.to_a
end
end
@@ -10,10 +16,10 @@ class FullTimeZoneInput < SimpleForm::Inputs::CollectionSelectInput
label, value = options.delete(:label_method), options.delete(:value_method)
label ||= ->(tz) do
- tz = ActiveSupport::TimeZone[tz.last]
+ tz = ActiveSupport::TimeZone[tz.first]
"(#{tz.formatted_offset}) #{tz.name}"
end
- value ||= :last
+ value ||= :first
[label, value]
end