From c3ba9022cf5729023be5b2e34a55d9db4acf594e Mon Sep 17 00:00:00 2001 From: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com> Date: Sun, 10 Sep 2023 19:16:38 -0300 Subject: [PATCH] Fix news dates. (#1040) --- website/src/.vitepress/theme/components/News.vue | 11 ++++++++++- ...dated-website.md => 2023-09-10-updated-website.md} | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) rename website/src/news/{2023-09-09-updated-website.md => 2023-09-10-updated-website.md} (98%) diff --git a/website/src/.vitepress/theme/components/News.vue b/website/src/.vitepress/theme/components/News.vue index 28f3302f..fddc8b09 100644 --- a/website/src/.vitepress/theme/components/News.vue +++ b/website/src/.vitepress/theme/components/News.vue @@ -6,6 +6,15 @@ const dateFormatter = new Intl.DateTimeFormat("en", { dateStyle: "medium", 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) +}