class Decidim::Attributes::TimeWithZone

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

Public Instance Methods

coerce(value) click to toggle source
# File lib/decidim/attributes/time_with_zone.rb, line 8
def coerce(value)
  return value unless value.is_a?(String)

  Time.zone.strptime(value, I18n.t("time.formats.decidim_short"))
rescue ArgumentError
  nil
end
type() click to toggle source
# File lib/decidim/attributes/time_with_zone.rb, line 16
def type
  Axiom::Types::Time
end