Sha256: f3596ff07d04c537ddfede4ab799abd0f7ffeb9784d60e8b49af6b05a67c578e

Contents?: true

Size: 450 Bytes

Versions: 39

Compression:

Stored size: 450 Bytes

Contents

# frozen_string_literal: true

module Alchemy
  module Ingredients
    # A datetime value
    #
    class Datetime < Alchemy::Ingredient
      def value
        ActiveRecord::Type::DateTime.new.cast(self[:value])
      end

      # Returns localized date for the Element#preview_text method.
      def preview_text(_maxlength = nil)
        return "" unless value

        ::I18n.l(value, format: :'alchemy.essence_date')
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
alchemy_cms-6.1.10 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.1.9 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.1.8 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.1.7 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.1.6 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.1.5 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.0.14 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.1.4 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.0.13 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.1.3 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.1.2 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.1.1 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.1.0 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.0.12 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.0.11 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.0.10 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.0.9 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.0.8 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.0.7 app/models/alchemy/ingredients/datetime.rb
alchemy_cms-6.0.6 app/models/alchemy/ingredients/datetime.rb