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



17
18
19
20
21
22
23
24
25
# File 'app/values/blacklight/types.rb', line 17

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