htmlDateString
continuous-integration/drone/push Build is passing

This commit is contained in:
inherentlee committed 2026-09-23 14:56:37 -07:00
1 parent 63ced4bddf
commit 61dc9603a2
3 files changed
+11 -3

No files matched your search

+7 -1
View File
@@ -1,5 +1,6 @@
export default function (eleventyConfig) { import { DateTime } from "luxon";
export default function (eleventyConfig) {
/* Create a single alt string from a multi-string alt object */ /* Create a single alt string from a multi-string alt object */
eleventyConfig.addFilter("createAlt", (altObject) => { eleventyConfig.addFilter("createAlt", (altObject) => {
let alt; let alt;
@@ -12,6 +13,11 @@ export default function (eleventyConfig) {
return alt; return alt;
}); });
/* For <time> elements */
eleventyConfig.addFilter("htmlDateString", (dateObj) => {
return DateTime.fromJSDate(dateObj, { zone: "utc" }).toFormat("yyyy-LL-dd");
});
/* What it says on the tin */ /* What it says on the tin */
eleventyConfig.addFilter("randomize", function(array) { eleventyConfig.addFilter("randomize", function(array) {
// Create a copy of the array to avoid modifying the original // Create a copy of the array to avoid modifying the original
+2 -1
View File
@@ -12,7 +12,8 @@
"@11ty/eleventy": "^3.1.5", "@11ty/eleventy": "^3.1.5",
"@11ty/eleventy-img": "^6.0.4", "@11ty/eleventy-img": "^6.0.4",
"@11ty/eleventy-navigation": "^1.0.5", "@11ty/eleventy-navigation": "^1.0.5",
"@mdit/plugin-attrs": "^0.25.1" "@mdit/plugin-attrs": "^0.25.1",
"luxon": "^3.7.2"
} }
}, },
"node_modules/@11ty/dependency-tree": { "node_modules/@11ty/dependency-tree": {
+2 -1
View File
@@ -13,6 +13,7 @@
"@11ty/eleventy": "^3.1.5", "@11ty/eleventy": "^3.1.5",
"@11ty/eleventy-img": "^6.0.4", "@11ty/eleventy-img": "^6.0.4",
"@11ty/eleventy-navigation": "^1.0.5", "@11ty/eleventy-navigation": "^1.0.5",
"@mdit/plugin-attrs": "^0.25.1" "@mdit/plugin-attrs": "^0.25.1",
"luxon": "^3.7.2"
} }
} }