Skip to content

Commit cc7dfdf

Browse files
committed
Fix: date localization on mail notification
1 parent 3e10917 commit cc7dfdf

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

inc/notificationtargetnotification.class.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,21 @@ private function buildPDF($user_name = '')
144144
$start = new DateTime($graph['start']);
145145
$end = new DateTime($graph['end']);
146146

147-
$format = 'j';
147+
$format = 'd';
148148
if ($start->format('Y') != $end->format('Y')) {
149-
$format .= ' F Y';
149+
$format .= ' MMMM y';
150150
} elseif ($start->format('F') != $end->format('F')) {
151-
$format .= ' F';
151+
$format .= ' MMMM';
152152
}
153153

154+
$language = $_SESSION['glpilanguage'] ?? 'en_GB';
154155
$image_title = $LANG['plugin_mreporting'][$graph['class']][$graph['method']]['title'];
155-
$image_title .= ' du ' . $start->format($format);
156-
$image_title .= ' au ' . $end->format('j F Y');
157-
156+
$image_title .= ' ' . lcfirst(
157+
sprintf(__('From %1$s to %2$s'),
158+
IntlDateFormatter::formatObject($start, $format, $language),
159+
IntlDateFormatter::formatObject($end, 'd MMMM Y', $language)
160+
)
161+
);
158162
array_push($images, ['title' => $image_title,
159163
'base64' => $image_base64,
160164
'width' => $image_width,

0 commit comments

Comments
 (0)