Sha256: 58dfb14c77b3e93868f6997dbddd919111e127688ac7770dabb8573c96651786

Contents?: true

Size: 685 Bytes

Versions: 17

Compression:

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

17 entries across 17 versions & 1 rubygems

Version Path
locomotive_cms-0.0.3.3 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.3.1 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.2.9 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.2.8 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.2.7 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.2.6 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.2.5 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.2.4 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.2.3 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.2.2 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.2.1 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.2 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.1.4 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.1.3 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.1.2 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.1.1 lib/locomotive/liquid/filters/date.rb
locomotive_cms-0.0.1 lib/locomotive/liquid/filters/date.rb