Skip to content

Instantly share code, notes, and snippets.

@reinier
Created February 24, 2019 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reinier/ac5f2a8d62471569f8ff607fd548b72c to your computer and use it in GitHub Desktop.
Save reinier/ac5f2a8d62471569f8ff607fd548b72c to your computer and use it in GitHub Desktop.
Translate date plugin for Jekyll. Use as `{{ post.date | dutchDate }}`
module Jekyll
module DutchDates
MONTHS = {"01" => "januari", "02" => "februari", "03" => "maart",
"04" => "april", "05" => "mei", "06" => "juni",
"07" => "juli", "08" => "augustus", "09" => "september",
"10" => "oktober", "11" => "november", "12" => "december"}
# http://man7.org/linux/man-pages/man3/strftime.3.html
def dutchDate(date)
day = time(date).strftime("%e") # leading zero is replaced by a space
month = time(date).strftime("%m")
year = time(date).strftime("%Y")
day+' '+MONTHS[month]+', '+year
end
end
end
Liquid::Template.register_filter(Jekyll::DutchDates)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment