Sha256: 37ae9d5a15450f25c224275fe3cd93a6020a3961e6940c31f5ed6bfef00c7bca

Contents?: true

Size: 334 Bytes

Versions: 61

Compression:

Stored size: 334 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

61 entries across 61 versions & 2 rubygems

Version Path
decidim-core-0.6.3 lib/decidim/attributes/time_with_zone.rb
decidim-0.6.3 decidim-core/lib/decidim/attributes/time_with_zone.rb
decidim-core-0.6.2 lib/decidim/attributes/time_with_zone.rb
decidim-0.6.2 decidim-core/lib/decidim/attributes/time_with_zone.rb
decidim-core-0.6.1 lib/decidim/attributes/time_with_zone.rb
decidim-0.6.1 decidim-core/lib/decidim/attributes/time_with_zone.rb
decidim-core-0.6.0 lib/decidim/attributes/time_with_zone.rb
decidim-0.6.0 decidim-core/lib/decidim/attributes/time_with_zone.rb
decidim-core-0.5.1 lib/decidim/attributes/time_with_zone.rb
decidim-0.5.1 decidim-core/lib/decidim/attributes/time_with_zone.rb
decidim-core-0.5.0 lib/decidim/attributes/time_with_zone.rb
decidim-0.5.0 decidim-core/lib/decidim/attributes/time_with_zone.rb
decidim-core-0.4.4 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.4.2 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.4.1 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.4.3 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.4.0 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.3.2 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.3.1 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.3.0 lib/decidim/attributes/time_with_zone.rb