Created
February 24, 2019 20:11
-
-
Save reinier/ac5f2a8d62471569f8ff607fd548b72c to your computer and use it in GitHub Desktop.
Translate date plugin for Jekyll. Use as `{{ post.date | dutchDate }}`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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