Class: Datagrid::Filters::DateTimeFilter

Inherits:
BaseFilter
  • Object
show all
Includes:
RangedFilter
Defined in:
lib/datagrid/filters/date_time_filter.rb

Instance Attribute Summary

Attributes inherited from BaseFilter

#block, #grid_class, #name, #options

Instance Method Summary collapse

Methods included from RangedFilter

#default_filter_where, #initialize, #parse_values, #range?

Methods inherited from BaseFilter

#allow_blank?, #allow_nil?, #apply, #default, #default_filter_block, #dummy?, #enabled?, #form_builder_helper_name, form_builder_helper_name, #header, #initialize, #multiple?, #parse_values, #separator, #supports_range?, #type, #unapplicable_value?

Instance Method Details

#format(value) ⇒ Object


11
12
13
14
15
16
17
# File 'lib/datagrid/filters/date_time_filter.rb', line 11

def format(value)
  if formats.any? && value
    value.strftime(formats.first)
  else
    super
  end
end

#parse(value) ⇒ Object


7
8
9
# File 'lib/datagrid/filters/date_time_filter.rb', line 7

def parse(value)
  Datagrid::Utils.parse_datetime(value)
end