How to filter :time_zone between GMTs using simple-form?
-
20-12-2019 - |
Question
= simple_form_for user,
= f.input :time_zone
Return a dropbox with all timezones between GMT-11:00 to GMT+13:00 and it respective timezone names.
How to filter/show only between GMT+02:00 to GMT-05:00 at dropbox and it to keep the same structure with (GMT-HH:MM) ZONE_NAME
?
Solution
The only way I founded was add a helper:
module TimezonesHelper
def timezones_filtered
[['(GMT-05:00) Lima', 'Lima' ],
['(GMT-04:00) La Paz', 'La Paz' ],
['(GMT-03:00) Brasilia', 'Brasilia' ],
['(GMT+00:00) UTC', 'UTC' ]]
end
end
And used this way:
= simple_form_for user
= f.input :time_zone, selected: 'Brasilia', collection: timezones_filtered
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow