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.14.4 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.14.3 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.14.2 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.14.1 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.13.1 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.12.2 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.13.0 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.12.1 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.13.0.pre1 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.12.0 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.11.2 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.12.0.pre lib/decidim/attributes/time_with_zone.rb
decidim-core-0.11.1 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.11.0.pre1 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.10.1 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.10.0 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.9.3 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.9.2 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.9.1 lib/decidim/attributes/time_with_zone.rb
decidim-core-0.9.0 lib/decidim/attributes/time_with_zone.rb