Class: Hyrax::SolrDocument::Metadata::Solr::Date

Inherits:
Object
  • Object
show all
Defined in:
app/models/concerns/hyrax/solr_document/metadata.rb

Class Method Summary collapse

Class Method Details

.coerce(input) ⇒ Date

Returns:



31
32
33
34
35
36
37
38
39
# File 'app/models/concerns/hyrax/solr_document/metadata.rb', line 31

def self.coerce(input)
  field = String.coerce(input)
  return if field.blank?
  begin
    ::Date.parse(field)
  rescue ArgumentError
    Hyrax.logger.info "Unable to parse date: #{field.first.inspect}"
  end
end