Sha256: 01aa3f43fcadae811c663d3b723078f38abeab3251251c9a50fd2c770dbf5adb

Contents?: true

Size: 815 Bytes

Versions: 1

Compression:

Stored size: 815 Bytes

Contents

module Jekyll
  module LanguagePlugin
    module Filters
      module LanguageDateFilter
        def tdate(input, fkey)
          if ((input.is_a?(String) && !/^\d+$/.match(input).nil?) || input.is_a?(Integer)) && input.to_i > 0
            date = Time.at(input.to_i)
          elsif input.is_a?(String)
            case input.downcase
            when 'now', 'today'
              date = Time.now
            else
              date = Time.parse(input)
            end
          elsif input.is_a?(Time)
            date = input
          else
            date = nil
          end

          return "" if !date.is_a?(Time)
          LiquidContext.get_localized_date(@context, date, fkey)
        end
      end
    end
  end
end

Liquid::Template.register_filter(Jekyll::LanguagePlugin::Filters::LanguageDateFilter)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-language-plugin-1.2.3 lib/jekyll/language-plugin/filters/language_date.rb