Sha256: e791c07c3be10219ee0da95d3bb2eea583e3344dab36af8345363c0a576d0c98

Contents?: true

Size: 632 Bytes

Versions: 14

Compression:

Stored size: 632 Bytes

Contents

module Locomotive
  module Liquid
    module Filters
      module Date

        def localized_date(input, *args)
          format, locale = args[0], args[1] rescue 'en'

          date = input.is_a?(String) ? Time.parse(input) : input

          if format.to_s.empty?
            return input.to_s
          end

          date = input.is_a?(String) ? Time.parse(input) : input

          if date.respond_to?(:strftime)
            I18n.locale = locale
            I18n.l date, :format => format
          else
            input
          end
        end

      end

      ::Liquid::Template.register_filter(Date)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
locomotive_cms-1.0.0.beta.2 lib/locomotive/liquid/filters/date.rb
locomotive_cms-1.0.0.beta lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.4.beta12 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.4.beta11 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.4.beta10 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.4.beta9 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.4.beta8 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.4.beta7 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.4.beta5 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.4.beta4 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.4.beta3 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.4.beta2 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.4.beta1 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.4 lib/locomotive/liquid/filters/date.rb