Module: Sinatra::DateForms
- Defined in:
- lib/sinatra/support/dateforms.rb
Overview
Date helpers.
require 'sinatra/support/dateforms'
class Main < Sinatra::Base
register Sinatra::DateForms
end
Helpers
This plugin provides the following helpers:
month_choices - Provides month choices for dropdowns.
day_choices - Day choices.
year_choices - Year dropdown.
Settings
Provides the following settings in your application:
[+default_year_loffset+] (Numeric) How many years back to display.
Defaults to -60.
[+default_year_loffset+] (Numeric) How many years forward. Defaults
to 0.
[+default_month_names+] (Array) The names of the months. Defaults
To Date::MONTHNAMES.
You may change them like this:
Main.configure do |m|
m.set :default_year_loffset, -60
m.set :default_year_uoffset, 0
m.set :default_month_names, Date::MONTHNAMES
end
Defined Under Namespace
Modules: Helpers