module Jekyll::DateDe

Constants

ABBR_DAYNAMES_DE
ABBR_MONTHNAMES_DE
DAYNAMES_DE
MONTHNAMES_DE

Deutsche Lokalisation:

Public Instance Methods

datetime(date) click to toggle source

Returns a datetime if the input is a string

# File lib/jekyll/date_de.rb, line 24
def datetime(date)
  if date.class == String
    date = Time.parse(date)
  end
  date
end
format_date(date, format) click to toggle source

Formats date by given date format

# File lib/jekyll/date_de.rb, line 32
def format_date(date, format)
  date = datetime(date)
    if format.nil? || format.empty? || format == "ordinal"
      date_formatted = ordinalize(date)
    else
      format.gsub!(/%a/, ABBR_DAYNAMES_DE[date.wday])
      format.gsub!(/%A/, DAYNAMES_DE[date.wday])
      format.gsub!(/%b/, ABBR_MONTHNAMES_DE[date.mon])
      format.gsub!(/%B/, MONTHNAMES_DE[date.mon])
      date_formatted = date.strftime(format)
    end
    date_formatted
end
full_date_de(date) click to toggle source

Usage: {{ post.date | full_date_de }} Result: 13. Dezember 2017

# File lib/jekyll/date_de.rb, line 48
def full_date_de(date)
  format_date(date, "%d. %B %Y")
end