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}
|
<strong>Auteur :</strong> @${authorName}
|
||||||
</p>
|
</p>
|
||||||
<p style="margin: 5px 0; color: #666; font-size: 14px;">
|
<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>
|
||||||
<p style="margin: 5px 0; color: #666; font-size: 14px;">
|
<p style="margin: 5px 0; color: #666; font-size: 14px;">
|
||||||
<strong>Statut du vote :</strong>
|
<strong>Statut du vote :</strong>
|
||||||
@@ -178,7 +178,7 @@ export default function ExportPdfButton({versionData, isOutdated = false, size =
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="margin-top: 40px; padding-top: 20px; border-top: 1px solid #eee; font-size: 12px; color: #888; text-align: center;">
|
<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>
|
</div>
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ export default function PrintButton({versionData, isOutdated = false, size = 'me
|
|||||||
<strong>Auteur :</strong> @${authorName}
|
<strong>Auteur :</strong> @${authorName}
|
||||||
</div>
|
</div>
|
||||||
<div class="metadata">
|
<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>
|
||||||
<div class="metadata">
|
<div class="metadata">
|
||||||
<strong>Statut du vote :</strong>
|
<strong>Statut du vote :</strong>
|
||||||
@@ -319,7 +319,7 @@ export default function PrintButton({versionData, isOutdated = false, size = 'me
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
Imprimé depuis Konstitisyon.nu le ${formatDate(new Date(), 'PPpp')}
|
Imprimé depuis Konstitisyon.nu le ${formatDate(new Date(), 'PPpp', {withTimezone: true})}
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+9
-2
@@ -19,10 +19,17 @@ export function formatKonstitisyon(titres, articles) {
|
|||||||
return konstitisyon
|
return konstitisyon
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatDate(date, formatStr = 'PP') {
|
export function formatDate(date, formatStr = 'PP', {withTimezone = false} = {}) {
|
||||||
return format(date, formatStr, {
|
const formatted = format(date, formatStr, {
|
||||||
locale: fr
|
locale: fr
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (withTimezone) {
|
||||||
|
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
|
||||||
|
return `${formatted} (${timezone})`
|
||||||
|
}
|
||||||
|
|
||||||
|
return formatted
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hasRestrictedChar(text) {
|
export function hasRestrictedChar(text) {
|
||||||
|
|||||||
Reference in New Issue
Block a user