Class: Decidim::Attributes::TimeWithZone

Inherits:
Virtus::Attribute
  • Object
show all
Defined in:
lib/decidim/attributes/time_with_zone.rb

Overview

Custom Virtus value to parse a String representing a Time using the app TimeZone.

Instance Method Summary collapse

Instance Method Details

#coerce(value) ⇒ Object



8
9
10
11
# File 'lib/decidim/attributes/time_with_zone.rb', line 8

def coerce(value)
  return value unless value.is_a?(String)
  Time.zone.parse(value)
end