feat: ajout de la timezone pour les exports
This commit is contained in:
@@ -159,7 +159,7 @@ export default function ExportPdfButton({versionData, isOutdated = false, size =
|
||||
<strong>Auteur :</strong> @${authorName}
|
||||
</p>
|
||||
<p style="margin: 5px 0; color: #666; font-size: 14px;">
|
||||
<strong>Date de création :</strong> ${formatDate(versionData.date_created, 'PPpp')}
|
||||
<strong>Date de création :</strong> ${formatDate(versionData.date_created, 'PPpp', {withTimezone: true})}
|
||||
</p>
|
||||
<p style="margin: 5px 0; color: #666; font-size: 14px;">
|
||||
<strong>Statut du vote :</strong>
|
||||
@@ -178,7 +178,7 @@ export default function ExportPdfButton({versionData, isOutdated = false, size =
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 40px; padding-top: 20px; border-top: 1px solid #eee; font-size: 12px; color: #888; text-align: center;">
|
||||
Exporté depuis Konstitisyon.nu le ${formatDate(new Date(), 'PPpp')}
|
||||
Exporté depuis Konstitisyon.nu le ${formatDate(new Date(), 'PPpp', {withTimezone: true})}
|
||||
</div>
|
||||
`
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ export default function PrintButton({versionData, isOutdated = false, size = 'me
|
||||
<strong>Auteur :</strong> @${authorName}
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<strong>Date de création :</strong> ${formatDate(versionData.date_created, 'PPpp')}
|
||||
<strong>Date de création :</strong> ${formatDate(versionData.date_created, 'PPpp', {withTimezone: true})}
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<strong>Statut du vote :</strong>
|
||||
@@ -319,7 +319,7 @@ export default function PrintButton({versionData, isOutdated = false, size = 'me
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
Imprimé depuis Konstitisyon.nu le ${formatDate(new Date(), 'PPpp')}
|
||||
Imprimé depuis Konstitisyon.nu le ${formatDate(new Date(), 'PPpp', {withTimezone: true})}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+9
-2
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user