]> git.agnieray.net Git - galette.git/commitdiff
strftime() is deprecated in php 8.1
authorGuillaume AGNIERAY <dev@agnieray.net>
Sat, 30 Sep 2023 11:09:19 +0000 (13:09 +0200)
committerJohan Cwiklinski <trasher@x-tnd.be>
Sat, 30 Sep 2023 16:52:33 +0000 (18:52 +0200)
galette/lib/Galette/IO/PdfAttendanceSheet.php

index 4919630295c79551537f359d358131cb80ff3331..c26a5e17e4cfce193d38ba13fc7b166cf478d597 100644 (file)
@@ -164,19 +164,18 @@ class PdfAttendanceSheet extends Pdf
         $this->PageHeader($this->doc_title);
 
         if ($this->sheet_date) {
-            $date_fmt = null;
-            if (PHP_OS === 'Linux') {
-                $format = _T("%A, %B %#d%O %Y");
-                $format = str_replace(
-                    '%O',
-                    date('S', $this->sheet_date->getTimestamp()),
-                    $format
-                );
-                $date_fmt = strftime($format, $this->sheet_date->getTimestamp());
-            } else {
-                $format = __("Y-m-d");
-                $date_fmt = $this->sheet_date->format($format);
-            }
+            $format = str_replace('(not translated)', '', _T("MMMM, EEEE d y"));
+            $formatter = new \IntlDateFormatter(
+                $this->i18n->getLongID(),
+                \IntlDateFormatter::FULL,
+                \IntlDateFormatter::NONE,
+                \date_default_timezone_get(),
+                \IntlDateFormatter::GREGORIAN,
+                $format
+            );
+            $datetime = new \DateTimeImmutable($this->sheet_date->format('Y-m-d'));
+            $date = \DateTime::createFromImmutable($datetime);
+            $date_fmt = ucwords($formatter->format($date));
             $this->Cell(190, 7, $date_fmt, 0, 1, 'C');
         }