class ActionView::Helpers::DateTimeSelector

:nodoc:

def build_day_options(selected)

..."

=> "
build_day_options(2)

If use_two_digit_numbers: true option is passed to DateTimeSelector

..."

=> "
build_day_options(2)

If day_format: ->(day) { day.ordinalize } option is passed to DateTimeSelector

..."

=> "
build_day_options(2)

Build select option HTML for day.
def build_day_options(selected)
  select_options = []
  (1..31).each do |value|
    tag_options = { value: value }
    tag_options[:selected] = "selected" if selected == value
    text = day_name(value)
    select_options << content_tag("option", text, tag_options)
  end
  (select_options.join("\n") + "\n").html_safe
end

def build_hidden(type, value)

=> ""
build_hidden(:year, 2008)

Builds hidden input tag for date part and value.
def build_hidden(type, value)
  select_options = {
    type: "hidden",
    id: input_id_from_type(type),
    name: input_name_from_type(type),
    value: value,
    autocomplete: "off"
  }.merge!(@html_options.slice(:disabled))
  select_options[:disabled] = "disabled" if @options[:disabled]
  tag(:input, select_options) + "\n".html_safe
end

def build_options(selected, options = {})

..."

=> "
build_options(15, start: 1, end: 31, step: 2)

If :step options is passed:

..."

=> "
build_options(15, start: 1, end: 31, use_two_digit_numbers: true)

If use_two_digit_numbers: true option is passed:

..."

=> "
build_options(15, start: 1, end: 31)

Build select option HTML from date value and options.
def build_options(selected, options = {})
  options = {
    leading_zeros: true, ampm: false, use_two_digit_numbers: false
  }.merge!(options)
  start         = options.delete(:start) || 0
  stop          = options.delete(:end) || 59
  step          = options.delete(:step) || 1
  leading_zeros = options.delete(:leading_zeros)
  select_options = []
  start.step(stop, step) do |i|
    value = leading_zeros ? sprintf("%02d", i) : i
    tag_options = { value: value }
    tag_options[:selected] = "selected" if selected == i
    text = options[:use_two_digit_numbers] ? sprintf("%02d", i) : value
    text = options[:ampm] ? AMPM_TRANSLATION[i] : text
    select_options << content_tag("option", text, tag_options)
  end
  (select_options.join("\n") + "\n").html_safe
end

def build_options_and_select(type, selected, options = {})

Build full select tag from date type and options.
def build_options_and_select(type, selected, options = {})
  build_select(type, build_options(selected, options))
end

def build_select(type, select_options_as_html)

"
...
=> "