-
-
Save jensgro/5bfcfd516549c16800084b092e3a69d5 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 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
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