fix displayed dates to be in utc

This commit is contained in:
eggy 2021-04-16 23:11:08 -04:00
parent f07c4c8326
commit 9b29c3d1ad
4 changed files with 10 additions and 3 deletions

View File

@ -28,6 +28,13 @@ module.exports = function(eleventyConfig) {
return Math.max(1, Math.floor(textOnly.length / readingSpeedPerMin)) return Math.max(1, Math.floor(textOnly.length / readingSpeedPerMin))
}) })
// get proper date in utc
eleventyConfig.addFilter('realDate', (value) => {
const actualDate = value;
actualDate.setDate(value.getDate() + 1);
return actualDate;
})
// Enable us to iterate over all the tags, excluding posts and all // Enable us to iterate over all the tags, excluding posts and all
eleventyConfig.addCollection('tagList', collection => { eleventyConfig.addCollection('tagList', collection => {
const tagsSet = new Set() const tagsSet = new Set()

View File

@ -9,7 +9,7 @@ layout: main
</p> </p>
<div> <div>
<em>{{ date | date: "%Y-%m-%d" }}</em> &middot; <em>{{ date | realDate | date: "%Y-%m-%d" }}</em> &middot;
<span>{{ content | readTime }} min read</span> <span>{{ content | readTime }} min read</span>
</div> </div>

View File

@ -15,7 +15,7 @@ pagination:
<span class="text-2xl sm:text-2xl font-bold hover:text-blue-700 leading-tight"><a href="{{ post.url }}">{{ post.data.title }}</a></span> <span class="text-2xl sm:text-2xl font-bold hover:text-blue-700 leading-tight"><a href="{{ post.url }}">{{ post.data.title }}</a></span>
<span class="text-base sm:text-2xs font-normal"> &middot; {{ post.templateContent | readTime }} min read</span> <span class="text-base sm:text-2xs font-normal"> &middot; {{ post.templateContent | readTime }} min read</span>
</p> </p>
<em>{{ post.date | date: "%Y-%m-%d" }}</em> <em>{{ post.date | realDate | date: "%Y-%m-%d" }}</em>
<p class="mt-4">{{ post.data.post_excerpt }}...</p> <p class="mt-4">{{ post.data.post_excerpt }}...</p>
<div class="flex justify-between items-center mt-4"> <div class="flex justify-between items-center mt-4">

View File

@ -14,7 +14,7 @@ eleventyComputed:
<p> <p>
<span class="text-2xl sm:text-2xl font-bold hover:underline"><a href="{{ post.url }}">{{ post.data.title }}</a></span> <span class="text-2xl sm:text-2xl font-bold hover:underline"><a href="{{ post.url }}">{{ post.data.title }}</a></span>
</p> </p>
<em>{{ post.date | date: "%Y-%m-%d" }}</em> <em>{{ post.date | realDate | date: "%Y-%m-%d" }}</em>
<p class="mt-4">{{ post.data.post_excerpt }}... <p class="mt-4">{{ post.data.post_excerpt }}...
<span class="hover:underline text-indigo-500"><a href="{{ post.url }}">Read More</a></span> <span class="hover:underline text-indigo-500"><a href="{{ post.url }}">Read More</a></span>
</p> </p>