Created
February 15, 2019 12:21
-
-
Save danfascia/ead90fe8ef55c9a9369123c21cfcea43 to your computer and use it in GitHub Desktop.
11ty Date formatting filter using Luxon. Usage: {{ date_field | date('dd LLLL yyyy') }}
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
const { DateTime } = require("luxon"); | |
// date filter formatting using Luxon. Usage: {{ date_field | date('dd LLLL yyyy') }} | |
eleventyConfig.addFilter("date", (it, format = "LLLL dd, yyyy") => { | |
return DateTime.fromJSDate(it, { zone: "utc" }).toFormat(format); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment