method

weekday_options_for_select

Importance_1
v7.1.3.2 - Show latest stable - 0 notes - Class: ActionView::Helpers::FormOptionsHelper
weekday_options_for_select(selected = nil, index_as_value: false, day_format: :day_names, beginning_of_week: Date.beginning_of_week) public

Returns a string of option tags for the days of the week.

Options:

  • :index_as_value - Defaults to false, set to true to use the indexes from I18n.translate("date.day_names") as the values. By default, Sunday is always 0.

  • :day_format - The I18n key of the array to use for the weekday options. Defaults to :day_names, set to :abbr_day_names for abbreviations.

  • :beginning_of_week - Defaults to Date.beginning_of_week.

NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag.

Show source
Register or log in to add new notes.