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:


34
35
36
37
38
39
40
41
42
# File 'app/models/concerns/hyrax/solr_document/metadata.rb', line 34

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