Class: Blacklight::Types::Date

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

Class Method Summary collapse

Class Method Details

.coerce(input) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'app/values/blacklight/types.rb', line 19

def self.coerce(input)
  field = String.coerce(input)
  return if field.blank?

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