diff --git a/includes/class-html-exporter.php b/includes/class-html-exporter.php
index ffd8a86..df8fd78 100644
--- a/includes/class-html-exporter.php
+++ b/includes/class-html-exporter.php
@@ -200,7 +200,7 @@ body { margin: 0 !important; padding: 0 !important; }
-
+
|
@@ -211,7 +211,13 @@ body { margin: 0 !important; padding: 0 !important; }
|
|
-
+
+
|
@@ -536,11 +542,14 @@ body { margin: 0 !important; padding: 0 !important; }
private function format_date_for_category(int $post_id, int $cat_id): string {
$window = Thalim_NL_Post_Query::get_window_type($cat_id);
+ // Ouvrages : année seule, comme l'affichage des cartes côté front.
+ $date_format = ($cat_id === THALIM_NL_CAT_OUVRAGES) ? 'Y' : 'j F Y';
+
if ($window === 'debut_minus35_to_fin') {
$raw_debut = get_post_meta($post_id, 'date_de_debut', true) ?: '';
$raw_fin = get_post_meta($post_id, 'date_de_fin', true) ?: '';
- $debut_str = $this->format_raw_date($raw_debut);
- $fin_str = $this->format_raw_date($raw_fin);
+ $debut_str = $this->format_raw_date($raw_debut, $date_format);
+ $fin_str = $this->format_raw_date($raw_fin, $date_format);
if ($debut_str && $fin_str && $debut_str !== $fin_str) {
return $debut_str . '–' . $fin_str;
}
@@ -549,18 +558,18 @@ body { margin: 0 !important; padding: 0 !important; }
$raw_dt = get_post_meta($post_id, 'datetime', true) ?: '';
if ($raw_dt && !str_starts_with($raw_dt, '0000-00-00')) {
- return $this->format_raw_date($raw_dt);
+ return $this->format_raw_date($raw_dt, $date_format);
}
$post = get_post($post_id);
- return $post ? $this->format_raw_date($post->post_date) : '';
+ return $post ? $this->format_raw_date($post->post_date, $date_format) : '';
}
- private function format_raw_date(string $raw): string {
+ private function format_raw_date(string $raw, string $format = 'j F Y'): string {
if (!$raw || str_starts_with($raw, '0000-00-00')) {
return '';
}
$ts = strtotime($raw);
- return $ts ? date_i18n('j F Y', $ts) : '';
+ return $ts ? date_i18n($format, $ts) : '';
}
// ── Rich-text processor (intro / conclusion) ──────────────────────────────
|