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

Instance Method Details

#cast(input) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'app/values/blacklight/types.rb', line 56

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