module ActionView::Helpers::DateHelper
def select_hour(datetime, options = {}, html_options = {})
# Generates a select field that includes options for hours from 2 to 14.
select_hour(my_time, ampm: true)
# Generate a select field for hours in the AM/PM format
select_hour(13, prompt: 'Choose hour')
# generic prompt.
# Generates a select field for hours with a custom prompt. Use prompt: true for a
select_hour(my_time, field_name: 'stride')
# that is named 'stride' rather than 'hour'.
# Generates a select field for hours that defaults to the hour for the time in my_time
select_hour(13)
# Generates a select field for hours that defaults to the number given.
select_hour(my_time)
# Generates a select field for hours that defaults to the hour for the time in my_time.
my_time = Time.now + 6.hours
Override the field name using the :field_name option, 'hour' by default.
The datetime can be either a +Time+ or +DateTime+ object or an integer.
Returns a select tag with options for each of the hours 0 through 23 with the current hour selected.
def select_hour(datetime, options = {}, html_options = {}) DateTimeSelector.new(datetime, options, html_options).select_hour end