Rename niceDate variable to formatDate

This commit is contained in:
Helen Chong 2024-05-10 10:34:12 +08:00
parent e21fbcfc9f
commit 4ed5a38efc
15 changed files with 19 additions and 19 deletions

View File

@ -4,7 +4,7 @@
<subtitle>Leilukin&#39;s personal website.</subtitle> <subtitle>Leilukin&#39;s personal website.</subtitle>
<link href="https://leilukin.neocities.org/feed.xml" rel="self"/> <link href="https://leilukin.neocities.org/feed.xml" rel="self"/>
<link href="https://leilukin.neocities.org"/> <link href="https://leilukin.neocities.org"/>
<updated>2024-05-10T00:16:30Z</updated> <updated>2024-05-10T02:32:54Z</updated>
<id>https://leilukin.neocities.org</id> <id>https://leilukin.neocities.org</id>
<author> <author>
<name>Leilukin</name> <name>Leilukin</name>

View File

@ -46,7 +46,7 @@ module.exports = function (eleventyConfig) {
day: 'numeric', day: 'numeric',
}; };
const dateTimeLocale = new Intl.DateTimeFormat("en-GB", dateOptions); const dateTimeLocale = new Intl.DateTimeFormat("en-GB", dateOptions);
eleventyConfig.addFilter("niceDate", function(date) { eleventyConfig.addFilter("formatDate", function(date) {
return dateTimeLocale.format(date); return dateTimeLocale.format(date);
}); });

View File

@ -13,9 +13,9 @@
{% if isArticle %} {% if isArticle %}
<h1>{{ articleTitle }}</h1> <h1>{{ articleTitle }}</h1>
<div class="article__info"> <div class="article__info">
<p>Posted on {{ date | niceDate }} by {{ sitemeta.siteAuthor.name }} <p>Posted on {{ date | formatDate }} by {{ sitemeta.siteAuthor.name }}
{% if updated %} {% if updated %}
• Last updated on {{ updated | niceDate }}</p> • Last updated on {{ updated | formatDate }}</p>
{% endif %} {% endif %}
{% if categories %} {% if categories %}
<p>Categories: <p>Categories:

View File

@ -9,7 +9,7 @@
{% endif %} {% endif %}
</a> </a>
</p> </p>
<time>{{ content.date | niceDate }}</time> <time>{{ content.date | formatDate }}</time>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@ -1,7 +1,7 @@
<article> <article>
{% for log in changelogList | reverse %} {% for log in changelogList | reverse %}
<div class="heading-wrapper h2"> <div class="heading-wrapper h2">
<h2 id="{{ log.fileSlug }}">{{ log.date | niceDate }}</h2> <h2 id="{{ log.fileSlug }}">{{ log.date | formatDate }}</h2>
<a class="heading-anchor" href="#{{ log.fileSlug }}" aria-labelledby="{{ log.fileSlug }}"><span hidden="">#</span></a> <a class="heading-anchor" href="#{{ log.fileSlug }}" aria-labelledby="{{ log.fileSlug }}"><span hidden="">#</span></a>
</div> </div>
{{ log.templateContent | safe }} {{ log.templateContent | safe }}

View File

@ -20,7 +20,7 @@ eleventyNavigation:
{% endif %} {% endif %}
</a> </a>
</h2> </h2>
<time>{{ post.date | niceDate }}</time> <time>{{ post.date | formatDate }}</time>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@ -19,7 +19,7 @@ eleventyNavigation:
<article> <article>
<h2>Latest Changelogs</h2> <h2>Latest Changelogs</h2>
{% for log in changelogs %} {% for log in changelogs %}
<h3 class="date-style">{{ log.data.date | niceDate }}</h3> <h3 class="date-style">{{ log.data.date | formatDate }}</h3>
{{ log.templateContent | safe }} {{ log.templateContent | safe }}
{%- endfor %} {%- endfor %}
</article> </article>

View File

@ -2,6 +2,6 @@
"tags": ["changelogs", "feed items"], "tags": ["changelogs", "feed items"],
"permalink": false, "permalink": false,
"eleventyComputed": { "eleventyComputed": {
"title": "Changelog: {{ date | niceDate }}" "title": "Changelog: {{ date | formatDate }}"
} }
} }

View File

@ -29,7 +29,7 @@ eleventyNavigation:
<h2>Updates</h2> <h2>Updates</h2>
<div class="text-box"> <div class="text-box">
{% for log in collections["changelogs"] | reverse | itemLimit(1) %} {% for log in collections["changelogs"] | reverse | itemLimit(1) %}
<h3 class="date-style">{{ log.data.date | niceDate }}:</h3> <h3 class="date-style">{{ log.data.date | formatDate }}:</h3>
{{ log.templateContent | safe }} {{ log.templateContent | safe }}
{%- endfor %} {%- endfor %}
<p><a href="/changelogs">View all site changelogs</a></p> <p><a href="/changelogs">View all site changelogs</a></p>

View File

@ -16,7 +16,7 @@ Articles I have written.
{%- for article in collections["my articles"] -%} {%- for article in collections["my articles"] -%}
<li> <li>
<p><a href="{{ article.url }}">{{ article.data.articleTitle }}</a></p> <p><a href="{{ article.url }}">{{ article.data.articleTitle }}</a></p>
<time>{{ article.date | niceDate }}</time> <time>{{ article.date | formatDate }}</time>
</li> </li>
{%- endfor -%} {%- endfor -%}
</ul> </ul>
@ -32,7 +32,7 @@ Articles featuring other people's interview with me.
{%- for article in collections["featured articles"] -%} {%- for article in collections["featured articles"] -%}
<li> <li>
<p><a href="{{ article.url }}">{{ article.data.articleTitle }}</a></p> <p><a href="{{ article.url }}">{{ article.data.articleTitle }}</a></p>
<time>{{ article.date | niceDate }}</time> <time>{{ article.date | formatDate }}</time>
</li> </li>
{%- endfor -%} {%- endfor -%}
</ul> </ul>

View File

@ -26,7 +26,7 @@ eleventyNavigation:
{% endif %} {% endif %}
</a> </a>
</h2> </h2>
<time>{{ post.date | niceDate }}</time> <time>{{ post.date | formatDate }}</time>
<p>{{ post.data.desc }}</p> <p>{{ post.data.desc }}</p>
</li> </li>
{% endfor %} {% endfor %}

View File

@ -9,7 +9,7 @@ eleventyNavigation:
order: 3 order: 3
--- ---
*This page was last updated on {{ updated | niceDate }}.* *This page was last updated on {{ updated | formatDate }}.*
This is my [/now page](https://nownownow.com/about). You can find more pages like this at [nownownow.com](https://nownownow.com/). This is my [/now page](https://nownownow.com/about). You can find more pages like this at [nownownow.com](https://nownownow.com/).

View File

@ -18,7 +18,7 @@ eleventyNavigation:
{%- for article in collections["cassette beasts articles"] -%} {%- for article in collections["cassette beasts articles"] -%}
<li> <li>
<p><a href="{{ article.url }}">{{ article.data.articleTitle }}</a></p> <p><a href="{{ article.url }}">{{ article.data.articleTitle }}</a></p>
<time>{{ article.date | niceDate }}</time> <time>{{ article.date | formatDate }}</time>
</li> </li>
{%- endfor -%} {%- endfor -%}
</ul> </ul>

View File

@ -18,7 +18,7 @@ eleventyNavigation:
{%- for article in collections["kotor both articles"] -%} {%- for article in collections["kotor both articles"] -%}
<li> <li>
<p><a href="{{ article.url }}">{{ article.data.articleTitle }}</a></p> <p><a href="{{ article.url }}">{{ article.data.articleTitle }}</a></p>
<time>{{ article.date | niceDate }}</time> <time>{{ article.date | formatDate }}</time>
</li> </li>
{%- endfor -%} {%- endfor -%}
</ul> </ul>
@ -28,7 +28,7 @@ eleventyNavigation:
{%- for article in collections["kotor 1 articles"] -%} {%- for article in collections["kotor 1 articles"] -%}
<li> <li>
<p><a href="{{ article.url }}">{{ article.data.articleTitle }}</a></p> <p><a href="{{ article.url }}">{{ article.data.articleTitle }}</a></p>
<time>{{ article.date | niceDate }}</time> <time>{{ article.date | formatDate }}</time>
</li> </li>
{%- endfor -%} {%- endfor -%}
</ul> </ul>
@ -38,7 +38,7 @@ eleventyNavigation:
{%- for article in collections["kotor 2 articles"] -%} {%- for article in collections["kotor 2 articles"] -%}
<li> <li>
<p><a href="{{ article.url }}">{{ article.data.articleTitle }}</a></p> <p><a href="{{ article.url }}">{{ article.data.articleTitle }}</a></p>
<time>{{ article.date | niceDate }}</time> <time>{{ article.date | formatDate }}</time>
</li> </li>
{%- endfor -%} {%- endfor -%}
</ul> </ul>

View File

@ -18,7 +18,7 @@ eleventyNavigation:
{%- for article in collections["kotor guides"] -%} {%- for article in collections["kotor guides"] -%}
<li> <li>
<p><a href="{{ article.url }}">{{ article.data.articleTitle }}</a></p> <p><a href="{{ article.url }}">{{ article.data.articleTitle }}</a></p>
<time>{{ article.date | niceDate }}</time> <time>{{ article.date | formatDate }}</time>
</li> </li>
{%- endfor -%} {%- endfor -%}
</ul> </ul>