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

Instance Method Details

#cast(input) ⇒ Object



69
70
71
72
73
74
75
76
77
78
# File 'app/values/blacklight/types.rb', line 69

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