Skip to content

Commit f856f0e

Browse files
committed
feat: add date format filter
1 parent 98823c0 commit f856f0e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

eleventy.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ export default function eleventy(eleventyConfig) {
1717
eleventyConfig.addPlugin(EleventyRenderPlugin);
1818
eleventyConfig.addPlugin(syntaxHighlightPlugin);
1919

20+
// eslint-disable-next-line prefer-arrow-callback
21+
eleventyConfig.addAsyncFilter('formatDate', function (value) {
22+
return new Date(value).toLocaleString('en-CA', {year: 'numeric', month: 'long', day: 'numeric'});
23+
});
24+
2025
eleventyConfig.addCollection('issues', collectionApi =>
2126
collectionApi
2227
.getFilteredByGlob('src/report/issues/*.md')

src/_layouts/report.njk

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ layout: base
1717
<dt>Target</dt>
1818
<dd>WCAG {{ targetWcagVersion }}, Level {{ targetLevel }}</dd>
1919
<dt>Date</dt>
20-
<dd>{{ date.toLocaleString("en-CA", {year: "numeric", month: "long", day: "numeric"}) }}</dd>
20+
<dd>{{ date | formatDate }}</dd>
2121
{% if specialRequirements %}
2222
<dt>Special requirements</dt>
2323
<dd>{{ specialRequirements }}</dd>

0 commit comments

Comments
 (0)