Fix news dates. (#1040)

This commit is contained in:
Alessandro Jean 2023-09-10 19:16:38 -03:00 committed by GitHub
parent fbdc4d5e5b
commit c3ba9022cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -6,6 +6,15 @@ const dateFormatter = new Intl.DateTimeFormat("en", {
dateStyle: "medium", dateStyle: "medium",
timeZone: "UTC", timeZone: "UTC",
}) })
function formatDate(date: string) {
const [year, month, day] = date
.substring(0, 10)
.split("-")
.map((number) => Number.parseInt(number, 10))
const utcDate = Date.UTC(year, month - 1, day)
return dateFormatter.format(utcDate)
}
</script> </script>
<template> <template>
@ -23,7 +32,7 @@ const dateFormatter = new Intl.DateTimeFormat("en", {
<div class="background" /> <div class="background" />
</h3> </h3>
<time :datetime="news.date"> <time :datetime="news.date">
{{ dateFormatter.format(new Date(news.date)) }} {{ formatDate(news.date) }}
</time> </time>
</div> </div>
<p>{{ news.description }}</p> <p>{{ news.description }}</p>

View File

@ -2,7 +2,7 @@
type: article type: article
title: Updated website title: Updated website
description: We've got a fresh new website we hope will be even easier to use description: We've got a fresh new website we hope will be even easier to use
date: 2023-09-09 date: 2023-09-10
--- ---
# Updated website # Updated website