Class: Unit::Types::Date
- Inherits:
-
Object
- Object
- Unit::Types::Date
- Defined in:
- lib/unit-ruby/types/date.rb
Class Method Summary collapse
Class Method Details
.as_json_api(value) ⇒ Object
13 14 15 16 17 |
# File 'lib/unit-ruby/types/date.rb', line 13 def self.as_json_api(value) return nil if value.nil? value.strftime('%F') end |
.cast(value) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/unit-ruby/types/date.rb', line 6 def self.cast(value) return nil if value.nil? return value if value.is_a?(::Date) ::Date.parse(value) end |