From 5a6fea8e69e768d30b366d1befcc808dee765abd Mon Sep 17 00:00:00 2001 From: Olivier Brian Date: Wed, 12 Jun 2024 23:59:47 +0200 Subject: [PATCH 1/2] :date: Add i18n to dateformat, default en-GB --- i18n.yml | 1 + src/components/ActiveIncidents.svelte | 2 +- src/components/ActiveScheduled.svelte | 2 +- src/components/Graph.svelte | 2 +- src/components/History.svelte | 2 +- src/components/Incident.svelte | 8 ++++---- src/components/Incidents.svelte | 2 +- src/components/Scheduled.svelte | 2 +- 8 files changed, 11 insertions(+), 10 deletions(-) diff --git a/i18n.yml b/i18n.yml index 26767c3..b5dc9d0 100644 --- a/i18n.yml +++ b/i18n.yml @@ -58,3 +58,4 @@ duration7D: 7d duration30D: 30d duration1Y: 1y durationAll: all +locale: en-GB diff --git a/src/components/ActiveIncidents.svelte b/src/components/ActiveIncidents.svelte index 2a2018c..d612835 100644 --- a/src/components/ActiveIncidents.svelte +++ b/src/components/ActiveIncidents.svelte @@ -57,7 +57,7 @@

{incident.title.replace("🛑", "").replace("⚠️", "").trim()}

{config.i18n.activeIncidentSummary - .replace(/\$DATE/g, new Date(incident.created_at).toLocaleString()) + .replace(/\$DATE/g, new Date(incident.created_at).toLocaleString(config.i18n.locale)) .replace(/\$POSTS/g, incident.comments)}
diff --git a/src/components/ActiveScheduled.svelte b/src/components/ActiveScheduled.svelte index 6460e91..7469c47 100644 --- a/src/components/ActiveScheduled.svelte +++ b/src/components/ActiveScheduled.svelte @@ -66,7 +66,7 @@ ? config.i18n.scheduledMaintenanceSummaryStarted : config.i18n.scheduledMaintenanceSummaryStarts ) - .replace(/\$DATE/g, new Date(incident.metadata.start).toLocaleString()) + .replace(/\$DATE/g, new Date(incident.metadata.start).toLocaleString(config.i18n.locale)) .replace( /\$DURATION/g, Math.floor( diff --git a/src/components/Graph.svelte b/src/components/Graph.svelte index 6309d69..d67f134 100644 --- a/src/components/Graph.svelte +++ b/src/components/Graph.svelte @@ -42,7 +42,7 @@ .map((commit) => parseInt(commit.commit.message.split(" in ")[1].split("ms")[0])); labels = commits .filter((commit) => commit.commit.message.includes("ms) [skip ci]")) - .map((commit) => new Date(commit.commit.committer.date).toLocaleString()); + .map((commit) => new Date(commit.commit.committer.date).toLocaleString(config.i18n.locale)); loading = false; }); diff --git a/src/components/History.svelte b/src/components/History.svelte index a93e2ff..f33e0ca 100644 --- a/src/components/History.svelte +++ b/src/components/History.svelte @@ -53,7 +53,7 @@

{config.i18n.pastIncidents}

{#each incidents as incident} {#if incident.showHeading} -

{new Date(incident.created_at).toLocaleDateString()}

+

{new Date(incident.created_at).toLocaleDateString(config.i18n.locale)}

{/if}