diff --git a/components/versions/export-pdf-button.js b/components/versions/export-pdf-button.js index 9eaef20..06ae409 100644 --- a/components/versions/export-pdf-button.js +++ b/components/versions/export-pdf-button.js @@ -159,7 +159,7 @@ export default function ExportPdfButton({versionData, isOutdated = false, size = Auteur : @${authorName}

- Date de création : ${formatDate(versionData.date_created, 'PPpp')} + Date de création : ${formatDate(versionData.date_created, 'PPpp', {withTimezone: true})}

Statut du vote : @@ -178,7 +178,7 @@ export default function ExportPdfButton({versionData, isOutdated = false, size =

- Exporté depuis Konstitisyon.nu le ${formatDate(new Date(), 'PPpp')} + Exporté depuis Konstitisyon.nu le ${formatDate(new Date(), 'PPpp', {withTimezone: true})}
` diff --git a/components/versions/print-button.js b/components/versions/print-button.js index 3dd6c80..0b57342 100644 --- a/components/versions/print-button.js +++ b/components/versions/print-button.js @@ -303,7 +303,7 @@ export default function PrintButton({versionData, isOutdated = false, size = 'me Auteur : @${authorName}
- Date de création : ${formatDate(versionData.date_created, 'PPpp')} + Date de création : ${formatDate(versionData.date_created, 'PPpp', {withTimezone: true})}
Statut du vote : @@ -319,7 +319,7 @@ export default function PrintButton({versionData, isOutdated = false, size = 'me
diff --git a/lib/format.js b/lib/format.js index 885e3ab..3563d53 100644 --- a/lib/format.js +++ b/lib/format.js @@ -19,10 +19,17 @@ export function formatKonstitisyon(titres, articles) { return konstitisyon } -export function formatDate(date, formatStr = 'PP') { - return format(date, formatStr, { +export function formatDate(date, formatStr = 'PP', {withTimezone = false} = {}) { + const formatted = format(date, formatStr, { locale: fr }) + + if (withTimezone) { + const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone + return `${formatted} (${timezone})` + } + + return formatted } export function hasRestrictedChar(text) {