method
select_time
v4.2.9 -
Show latest stable
-
0 notes -
Class: ActionView::Helpers::DateHelper
- 1.0.0 (0)
- 1.1.6 (0)
- 1.2.6 (3)
- 2.0.3 (38)
- 2.1.0 (4)
- 2.2.1 (0)
- 2.3.8 (15)
- 3.0.0 (0)
- 3.0.9 (-2)
- 3.1.0 (5)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (3)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- 7.2.3 (0)
- 8.0.0 (0)
- 8.1.1 (0)
- What's this?
select_time(datetime = Time.current, options = {}, html_options = {})
public
Returns a set of HTML select-tags (one for hour and minute). You can set :time_separator key to format the output, and the :include_seconds option to include an input for seconds.
If anything is passed in the html_options hash it will be applied to every select tag in the set.
my_time = Time.now + 5.days + 7.hours + 3.minutes + 14.seconds # Generates a time select that defaults to the time in my_time. select_time(my_time) # Generates a time select that defaults to the current time (no specified time). select_time() # Generates a time select that defaults to the time in my_time, # which has fields separated by ':'. select_time(my_time, time_separator: ':') # Generates a time select that defaults to the time in my_time, # that also includes an input for seconds. select_time(my_time, include_seconds: true) # Generates a time select that defaults to the time in my_time, that has fields # separated by ':' and includes an input for seconds. select_time(my_time, time_separator: ':', include_seconds: true) # Generate a time select field with hours in the AM/PM format select_time(my_time, ampm: true) # Generates a time select field with hours that range from 2 to 14 select_time(my_time, start_hour: 2, end_hour: 14) # Generates a time select with a custom prompt. Use <tt>:prompt</tt> to true for generic prompts. select_time(my_time, prompt: {day: 'Choose day', month: 'Choose month', year: 'Choose year'}) select_time(my_time, prompt: {hour: true}) # generic prompt for hours select_time(my_time, prompt: true) # generic prompts for all

