I am collecting a user's time zone during signup and storing in database with the following form (relevant part).
<%= a.input :time_zone, collection: ActiveSupport::TimeZone.us_zones.map { |zone| [zone.name, zone.name] }, required: true, label: "Select your time zone" %>
However, I would like to default the selection to the user's local time zone (based on OS) to speed up registration process. I tried using
<%= a.input :time_zone, collection: ActiveSupport::TimeZone.us_zones.map { |zone| [zone.name, zone.name] }, selected: Time.now.zone, required: true, label: "Select your time zone" %>
but it doesn't work because Time.now.zone is "Eastern Daylight Time" and the zone name is "Eastern Time (US & Canada)". Is there anyway to convert the Time.now.zone to the zone name .