module ActionView::Helpers::DateHelper
def select_month(date, options = {}, html_options = {})
# generic prompt.
# Generates a select field for months with a custom prompt. Use prompt: true for a
select_month(Date.today, use_two_digit_numbers: true)
# will use keys with two digit numbers like "01", "03".
# Generates a select field for months that defaults to the current month that
select_month(Date.today, use_month_names: %w(Januar Februar Marts ...))
# will use keys like "Januar", "Marts."
# Generates a select field for months that defaults to the current month that
select_month(Date.today, use_short_month: true)
# will use keys like "Jan", "Mar".
# Generates a select field for months that defaults to the current month that
select_month(Date.today, add_month_numbers: true)
# will use keys like "1 - January", "3 - March".
# Generates a select field for months that defaults to the current month that
select_month(Date.today, use_month_numbers: true)
# will use keys like "1", "3".
# Generates a select field for months that defaults to the current month that
select_month(Date.today, field_name: 'start')
# is named "start" rather than "month".
# Generates a select field for months that defaults to the current month that
select_month(Date.today)
# will use keys like "January", "March".
# Generates a select field for months that defaults to the current month that
Override the field name using the :field_name option, 'month' by default.
If you want to display months with a leading zero set the :use_two_digit_numbers key in +options+ to true.
to use your own month names, set the :use_month_names key in +options+ to an array of 12 month names.
to show month names as abbreviations, set the :use_short_month key in +options+ to true. If you want
want both numbers and names, set the :add_month_numbers key in +options+ to true. If you would prefer
instead of names -- set the :use_month_numbers key in +options+ to true for this to happen. If you
used as values (what's submitted to the server). It's also possible to use month numbers for the presentation
selected. The month names are presented as keys (what's shown to the user) and the month numbers (1-12) are
Returns a select tag with options for each of the months January through December with the current month
def select_month(date, options = {}, html_options = {}) DateTimeSelector.new(date, options, html_options).select_month end