class ActionView::Helpers::DateTimeSelector

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