Sha256: 72bc98fecb67b0c938422546135e4a947a7e43d3ef68c374eacb6bb2b29313f6

Contents?: true

Size: 319 Bytes

Versions: 22

Compression:

Stored size: 319 Bytes

Contents

class Datagrid::Filters::DateFilter < Datagrid::Filters::BaseFilter
  #TODO: more smart date normalizer
  def format(value)
    return nil if value.blank?
    return value.to_date if value.respond_to?(:to_date)
    return value unless value.is_a?(String)
    Date.parse(value)
  rescue ArgumentError
    nil
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
datagrid-0.6.4 lib/datagrid/filters/date_filter.rb
datagrid-0.6.3 lib/datagrid/filters/date_filter.rb
datagrid-0.6.2 lib/datagrid/filters/date_filter.rb
datagrid-0.6.0 lib/datagrid/filters/date_filter.rb
datagrid-0.5.4 lib/datagrid/filters/date_filter.rb
datagrid-0.5.3 lib/datagrid/filters/date_filter.rb
datagrid-0.5.2 lib/datagrid/filters/date_filter.rb
datagrid-0.5.1 lib/datagrid/filters/date_filter.rb
datagrid-0.5.0 lib/datagrid/filters/date_filter.rb
datagrid-0.4.1 lib/datagrid/filters/date_filter.rb
datagrid-0.4.0 lib/datagrid/filters/date_filter.rb
datagrid-0.3.6 lib/datagrid/filters/date_filter.rb
datagrid-0.3.5 lib/datagrid/filters/date_filter.rb
datagrid-0.3.4 lib/datagrid/filters/date_filter.rb
datagrid-0.3.3 lib/datagrid/filters/date_filter.rb
datagrid-0.3.2 lib/datagrid/filters/date_filter.rb
datagrid-0.3.1 lib/datagrid/filters/date_filter.rb
datagrid-0.3.0 lib/datagrid/filters/date_filter.rb
datagrid-0.2.0 lib/datagrid/filters/date_filter.rb
datagrid-0.1.2 lib/datagrid/filters/date_filter.rb