module ActionView::Helpers::DateHelper
def select_date(date = Date.current, options = {}, html_options = {})
select_date(my_date, prompt: { hour: true }) # generic prompt for hours
select_date(my_date, prompt: { day: 'Choose day', month: 'Choose month', year: 'Choose year' })
# Generates a date select with a custom prompt. Use prompt: true for generic prompts.
select_date(my_date, prefix: 'payday')
# prefixed with 'payday' rather than 'date'.
# Generates a date select that defaults to the datetime in my_date (six days after today)
select_date(my_date, date_separator: '/')
# which has fields separated by '/'.
# Generates a date select that defaults to the date in my_date,
select_date(my_date, discard_type: true)
# my_date (six days after today).
# Generates a date select that discards the type of the field and defaults to the date in
select_date(my_date, order: [:year, :month, :day])
# with the fields ordered year, month, day rather than month, day, year.
# Generates a date select that defaults to the date in my_date (six days after today)
select_date()
# Generates a date select that defaults to today (no specified date).
select_date(my_date)
# Generates a date select that defaults to the date in my_date (six days after today).
my_date = Time.now + 6.days
If anything is passed in the html_options hash it will be applied to every select tag in the set.
If the array passed to the :order option does not contain all the three symbols, all tags will be hidden.
symbols :year, :month and :day in the desired order.
It's possible to explicitly set the order of the tags using the :order option with an array of
Returns a set of HTML select-tags (one for year, month, and day) pre-selected with the +date+.
def select_date(date = Date.current, options = {}, html_options = {}) DateTimeSelector.new(date, options, html_options).select_date end