aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Utils.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2021-01-19 15:03:28 +0100
committerArthurHoaro <arthur@hoa.ro>2021-01-19 15:03:28 +0100
commitdafd3f081ab581e074f3280d4323dc92cb33df46 (patch)
tree67e2f7c94242eface8f0528d0753bc336079f36a /application/Utils.php
parent6b76ce6f6285fd0b3565fc911f6469d21a132149 (diff)
downloadShaarli-dafd3f081ab581e074f3280d4323dc92cb33df46.tar.gz
Shaarli-dafd3f081ab581e074f3280d4323dc92cb33df46.tar.zst
Shaarli-dafd3f081ab581e074f3280d4323dc92cb33df46.zip
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.
Diffstat (limited to 'application/Utils.php')
-rw-r--r--application/Utils.php1
1 files changed, 1 insertions, 0 deletions
diff --git a/application/Utils.php b/application/Utils.php
index 952378ab..c5cd884b 100644
--- a/application/Utils.php
+++ b/application/Utils.php
@@ -323,6 +323,7 @@ function format_date($date, $time = true, $intl = true)
323 IntlDateFormatter::LONG, 323 IntlDateFormatter::LONG,
324 $time ? IntlDateFormatter::LONG : IntlDateFormatter::NONE 324 $time ? IntlDateFormatter::LONG : IntlDateFormatter::NONE
325 ); 325 );
326 $formatter->setTimeZone($date->getTimezone());
326 327
327 return $formatter->format($date); 328 return $formatter->format($date);
328} 329}