Class: Warped::Filter::DateTime
- Defined in:
- lib/warped/api/filter/date_time.rb
Defined Under Namespace
Classes: Value
Constant Summary collapse
- RELATIONS =
%w[eq neq gt gte lt lte between is_null is_not_null].freeze
Instance Attribute Summary
Attributes inherited from Base
#alias_name, #name, #options, #strict
Instance Method Summary collapse
Methods inherited from Base
#initialize, kind, #kind, #parameter_name, #relation, #relations
Constructor Details
This class inherits a constructor from Warped::Filter::Base
Instance Method Details
#cast(value) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/warped/api/filter/date_time.rb', line 11 def cast(value) return if value.blank? ::DateTime.parse(value) rescue ::Date::Error raise ValueError, "#{value} cannot be casted to #{kind}" if strict nil end |
#html_type ⇒ Object
21 22 23 |
# File 'lib/warped/api/filter/date_time.rb', line 21 def html_type "datetime-local" end |