format_date: include timezone in IntlDateFormatter object

@see https://www.php.net/manual/en/intldateformatter.format.php

> If a DateTime or an IntlCalendar object is passed, its timezone is not considered. The object will be formatted using the formaterʼs configured timezone. If one wants to use the timezone of the object to be formatted, IntlDateFormatter::setTimeZone() must be called before with the objectʼs timezone.
This commit is contained in:
ArthurHoaro 2021-01-19 15:03:28 +01:00
parent 6b76ce6f62
commit dafd3f081a

View file

@ -323,6 +323,7 @@ function format_date($date, $time = true, $intl = true)
IntlDateFormatter::LONG,
$time ? IntlDateFormatter::LONG : IntlDateFormatter::NONE
);
$formatter->setTimeZone($date->getTimezone());
return $formatter->format($date);
}