Class: ProductGroupSearch::DateField
- Inherits:
-
NumberField
- Object
- BaseField
- NumberField
- ProductGroupSearch::DateField
- Defined in:
- lib/nimbleshop/product_group_search/date_field.rb
Instance Attribute Summary
Attributes inherited from BaseField
Instance Method Summary collapse
Methods inherited from NumberField
Methods inherited from BaseField
#initialize, #valid_operator?, #where
Constructor Details
This class inherits a constructor from ProductGroupSearch::BaseField
Instance Method Details
#coerced_value ⇒ Object
3 4 5 |
# File 'lib/nimbleshop/product_group_search/date_field.rb', line 3 def coerced_value Date.strptime(value.try(:to_s), "%d/%m/%Y") end |
#valid_value_data_type? ⇒ Boolean
7 8 9 10 11 12 13 14 |
# File 'lib/nimbleshop/product_group_search/date_field.rb', line 7 def valid_value_data_type? begin Date.strptime(value.try(:to_s), "%d/%m/%Y") true rescue false end end |