Sha256: 283c60c3d8b9a29585ede37e0b12f541d890fd4b5eb082de5bfa905968e9c11f

Contents?: true

Size: 333 Bytes

Versions: 5

Compression:

Stored size: 333 Bytes

Contents

# frozen_string_literal: true
module Decidim
  module Attributes
    # Custom Virtus value to parse a String representing a Time using
    # the app TimeZone.
    class TimeWithZone < Virtus::Attribute
      def coerce(value)
        return value unless value.is_a?(String)
        Time.zone.parse(value)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decidim-core-0.1.0 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.0.8.1 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.0.7 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.0.6 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.0.5 lib/decidim/attributes/time_with_zone.rb