Class: Blacklight::Types::Time

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

Instance Method Summary collapse

Methods inherited from Value

coerce, #initialize

Constructor Details

This class inherits a constructor from Blacklight::Types::Value

Instance Method Details

#cast(input) ⇒ Object



73
74
75
76
77
78
79
80
81
82
# File 'app/values/blacklight/types.rb', line 73

def cast(input)
  value = super
  return if value.blank?

  begin
    ::Time.parse(value.to_s) # rubocop:disable Rails/TimeZone
  rescue ArgumentError
    Rails.logger&.info "Unable to parse time: #{value.inspect}"
  end
end