diff --git a/_layouts/home.njk b/_layouts/home.njk index a6b9f56..ae60065 100644 --- a/_layouts/home.njk +++ b/_layouts/home.njk @@ -43,7 +43,7 @@ dont_show_lang_in_footer: true

{{ "recent-posts" | i18n }}

diff --git a/eleventy.config.js b/eleventy.config.js index 1d1d2a3..3d8fb27 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -1,6 +1,6 @@ -const { - I18nPlugin -} = require("@11ty/eleventy"); +const { I18nPlugin } = require("@11ty/eleventy"); +const { DateTime } = require("luxon"); + const i18n = require("eleventy-plugin-i18n"); const eleventySass = require("eleventy-sass"); const toml = require("@iarna/toml"); @@ -35,6 +35,10 @@ module.exports = function (eleventyConfig) { return filtered; }); + eleventyConfig.addFilter("date", function (dateObj, format) { + return DateTime.fromJSDate(dateObj).toFormat(format); + }); + eleventyConfig.addPlugin(eleventySass); eleventyConfig.addPlugin(I18nPlugin, { defaultLanguage: defaultLanguage, diff --git a/package-lock.json b/package-lock.json index d202cd3..900e161 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "@iarna/toml": "^2.2.5", "eleventy-plugin-i18n": "^0.1.3", "eleventy-sass": "^3.0.0-beta.0", + "luxon": "^3.7.2", "markdown-it-emoji": "^3.0.0", "markdown-it-emoji-customizer": "github:actuallysomecat/markdown-it-emoji-customizer", "sass": "^1.86.0" diff --git a/package.json b/package.json index 2692fba..30b5eeb 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "@iarna/toml": "^2.2.5", "eleventy-plugin-i18n": "^0.1.3", "eleventy-sass": "^3.0.0-beta.0", + "luxon": "^3.7.2", "markdown-it-emoji": "^3.0.0", "markdown-it-emoji-customizer": "github:actuallysomecat/markdown-it-emoji-customizer", "sass": "^1.86.0"