From 4c911cf4fc888c658afe39fef248434e22c00b62 Mon Sep 17 00:00:00 2001 From: Narindra ezway Date: Tue, 18 Mar 2025 10:02:56 +0300 Subject: [PATCH] formating date invoice --- gestion/lib/Helpers/DateHelpers.php | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/gestion/lib/Helpers/DateHelpers.php b/gestion/lib/Helpers/DateHelpers.php index 67de497..7f6de17 100644 --- a/gestion/lib/Helpers/DateHelpers.php +++ b/gestion/lib/Helpers/DateHelpers.php @@ -131,13 +131,24 @@ class DateHelpers } return $totalHours; } - public static function convertInvoiceDateToMonthAndYearOnly($invoiceDate = null){ - if(!$invoiceDate){ - return ""; - } - $dateTime = new DateTime($invoiceDate); - $formattedDate = strftime('%B %Y', $dateTime->getTimestamp()); - return $formattedDate; + public static function convertInvoiceDateToMonthAndYearOnly($invoiceDate = null) + { + if (!$invoiceDate) { + return ""; + } + + $dateTime = new DateTime($invoiceDate); + + $formatter = new IntlDateFormatter( + 'fr_FR', + IntlDateFormatter::LONG, + IntlDateFormatter::NONE, + null, + null, + 'MMMM yyyy' + ); + + return ucfirst($formatter->format($dateTime)); } }