module ActionView::Helpers::DateHelper

def select_datetime(datetime = Time.current, options = {}, html_options = {})

select_datetime(my_date_time, prompt: true) # generic prompts for all
select_datetime(my_date_time, prompt: {hour: true}) # generic prompt for hours
select_datetime(my_date_time, prompt: {day: 'Choose day', month: 'Choose month', year: 'Choose year'})
# Generates a datetime select with a custom prompt. Use prompt: true for generic prompts.

select_datetime(my_date_time, prefix: 'payday')
# prefixed with 'payday' rather than 'date'
# Generates a datetime select that defaults to the datetime in my_date_time (four days after today)

select_datetime(my_date_time, ampm: true)
# Generate a datetime field with hours in the AM/PM format

select_datetime(my_date_time, discard_type: true)
# my_date_time (four days after today)
# Generates a datetime select that discards the type of the field and defaults to the datetime in

select_datetime(my_date_time, date_separator: '/', time_separator: '', datetime_separator: ',')
# separated by a comma (',').
# with a date fields separated by '/', time fields separated by '' and the date and time fields
# Generates a datetime select that defaults to the datetime in my_date_time (four days after today)

select_datetime(my_date_time, date_separator: '/')
# with a '/' between each date field.
# Generates a datetime select that defaults to the datetime in my_date_time (four days after today)

select_datetime(my_date_time, order: [:year, :month, :day])
# with the fields ordered year, month, day rather than month, day, year.
# Generates a datetime select that defaults to the datetime in my_date_time (four days after today)

select_datetime()
# Generates a datetime select that defaults to today (no specified datetime)

select_datetime(my_date_time)
# Generates a datetime select that defaults to the datetime in my_date_time (four days after today).

my_date_time = Time.now + 4.days

If anything is passed in the html_options hash it will be applied to every select tag in the set.

control visual display of the elements.
:date_separator, :datetime_separator and :time_separator keys to the +options+ to
supply a Symbol, it will be appended onto the :order passed in. You can also add
an array of symbols :year, :month and :day in the desired order. If you do not
+datetime+. It's also possible to explicitly set the order of the tags using the :order option with
Returns a set of HTML select-tags (one for year, month, day, hour, minute, and second) pre-selected with the
def select_datetime(datetime = Time.current, options = {}, html_options = {})
  DateTimeSelector.new(datetime, options, html_options).select_datetime
end