module ActionView::Helpers::DateHelperInstanceTag
Public Instance Methods
to_date_select_tag(options = {}, html_options = {})
click to toggle source
# File lib/action_view/helpers/date_helper.rb, line 989 def to_date_select_tag(options = {}, html_options = {}) datetime_selector(options, html_options).select_date.html_safe end
to_datetime_select_tag(options = {}, html_options = {})
click to toggle source
# File lib/action_view/helpers/date_helper.rb, line 997 def to_datetime_select_tag(options = {}, html_options = {}) datetime_selector(options, html_options).select_datetime.html_safe end
to_time_select_tag(options = {}, html_options = {})
click to toggle source
# File lib/action_view/helpers/date_helper.rb, line 993 def to_time_select_tag(options = {}, html_options = {}) datetime_selector(options, html_options).select_time.html_safe end
Private Instance Methods
datetime_selector(options, html_options)
click to toggle source
# File lib/action_view/helpers/date_helper.rb, line 1002 def datetime_selector(options, html_options) datetime = value(object) || default_datetime(options) @auto_index ||= nil options = options.dup options[:field_name] = @method_name options[:include_position] = true options[:prefix] ||= @object_name options[:index] = @auto_index if @auto_index && !options.has_key?(:index) DateTimeSelector.new(datetime, options, html_options) end
default_datetime(options)
click to toggle source
# File lib/action_view/helpers/date_helper.rb, line 1015 def default_datetime(options) return if options[:include_blank] || options[:prompt] case options[:default] when nil Time.current when Date, Time options[:default] else default = options[:default].dup # Rename :minute and :second to :min and :sec default[:min] ||= default[:minute] default[:sec] ||= default[:second] time = Time.current [:year, :month, :day, :hour, :min, :sec].each do |key| default[key] ||= time.send(key) end Time.utc_time( default[:year], default[:month], default[:day], default[:hour], default[:min], default[:sec] ) end end