Class: Blacklight::Types::Date

Inherits:
Value
  • Object
show all
Defined in:
app/values/blacklight/types.rb

Instance Method Summary collapse

Methods inherited from Value

coerce, #initialize

Constructor Details

This class inherits a constructor from Blacklight::Types::Value

Instance Method Details

#cast(input) ⇒ Object



60
61
62
63
64
65
66
67
68
69
# File 'app/values/blacklight/types.rb', line 60

def cast(input)
  value = super
  return if value.blank?

  begin
    ::Date.parse(value.to_s)
  rescue ArgumentError
    Rails.logger&.info "Unable to parse date: #{value.inspect}"
  end
end