Created
April 8, 2020 18:19
-
-
Save ldd/6c9ed66422d7b0b90d8492e09a4ed8ec to your computer and use it in GitHub Desktop.
jekyll plugin to format date
This file contains hidden or 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::CustomFilter | |
def formatted_date(date) | |
# date = Time.parse(string_date) | |
ending = 'th' | |
case date.day % 10 | |
when 1 | |
ending = 'st' | |
when 2 | |
ending = 'nd' | |
when 3 | |
ending = 'rd' | |
end | |
date.strftime("%B %-d#{ending}, %Y") | |
end | |
end | |
Liquid::Template.register_filter(Jekyll::CustomFilter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment