Use intl to format date
authorCyperghost <olaf_schmitz_1@t-online.de>
Tue, 19 Dec 2023 11:05:13 +0000 (12:05 +0100)
committerCyperghost <olaf_schmitz_1@t-online.de>
Tue, 19 Dec 2023 11:05:13 +0000 (12:05 +0100)
wcfsetup/install/files/lib/data/cronjob/CronjobAction.class.php

index 7213c1b806b80454e1f083788f83900ec4beeaf0..493b91b4e888d2fe090271d8b44064b9d1b75400 100644 (file)
@@ -191,15 +191,12 @@ class CronjobAction extends AbstractDatabaseObjectAction implements IToggleActio
                     $dateTime = DateUtil::getDateTimeByTimestamp($nextExec);
                     $return[$cronjob->cronjobID] = [
                         'time' => $nextExec,
-                        'formatted' => \str_replace(
-                            '%time%',
-                            DateUtil::format($dateTime, DateUtil::TIME_FORMAT),
-                            \str_replace(
-                                '%date%',
-                                DateUtil::format($dateTime, DateUtil::DATE_FORMAT),
-                                WCF::getLanguage()->get('wcf.date.dateTimeFormat')
-                            )
-                        ),
+                        'formatted' => \IntlDateFormatter::create(
+                            WCF::getLanguage()->getLocale(),
+                            \IntlDateFormatter::LONG,
+                            \IntlDateFormatter::SHORT,
+                            WCF::getUser()->getTimeZone()
+                        )->format($dateTime),
                     ];
                 }