Add date filters
This commit is contained in:
parent
0ecf55e7be
commit
2b5a88ad70
1 changed files with 19 additions and 0 deletions
19
.eleventy.js
19
.eleventy.js
|
|
@ -11,6 +11,25 @@ module.exports = function (eleventyConfig) {
|
|||
'node_modules/simpledotcss/simple.css': 'css/simple.css',
|
||||
});
|
||||
|
||||
eleventyConfig.addFilter("makeRfc822Date", function (value) {
|
||||
return new Date(value).toUTCString();
|
||||
});
|
||||
eleventyConfig.addFilter("formatDatetimeForHumans", function (value) {
|
||||
const dt = new Date(value);
|
||||
const formattedDt = new Intl.DateTimeFormat("en", {
|
||||
dateStyle: "medium",
|
||||
timeStyle: "medium",
|
||||
}).format(dt);
|
||||
return formattedDt;
|
||||
});
|
||||
eleventyConfig.addFilter("formatDateForHumans", function (value) {
|
||||
const dt = new Date(value);
|
||||
const formattedDt = new Intl.DateTimeFormat("en", {
|
||||
dateStyle: "medium",
|
||||
}).format(dt);
|
||||
return formattedDt;
|
||||
});
|
||||
|
||||
const markdownLibrary = markdownIt()
|
||||
.use(markdownItAnchor, { slugify })
|
||||
.use(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue