ActionView::Helpers::FormOptionsHelper

time_zone_options_for_select

API docs (Rails 8.1.4.1) ↗
def time_zone_options_for_select(selected = nil, priority_zones = nil, model = ::ActiveSupport::TimeZone)

Description

Creates <option> elements for time zones.

Arguments

Changing a value updates the ERB and HTML.

= nil
"Tokyo"
Adds selected to the <option> whose value matches the given name. With an ActiveSupport::TimeZone object, no <option> gets selected.
= nil
Time zones to list first, followed by a disabled divider <option> (-------------) and then the remaining time zones. Takes an array of ActiveSupport::TimeZone objects or a regular expression. A regular expression picks the time zones whose name, or whose identifier such as Asia/Tokyo, matches it (/Tokyo/ also picks Osaka and Sapporo, which use Asia/Tokyo).

ERB

Changes from the previous output: Added Removed Changed


          

HTML


          

Preview

Interacting with the preview updates the form submission.

Form submission

Form data

namevalue
Request body

Content-Type:


              

params