From f15b2275a3aff73ece5dc5515b320c10452e6b48 Mon Sep 17 00:00:00 2001 From: ruan <2369127-ruany@users.noreply.gitlab.com> Date: Thu, 30 Dec 2021 11:12:55 +0200 Subject: [PATCH] Store date formatter instance --- inc/page.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inc/page.php b/inc/page.php index ed591cc..bbd9740 100644 --- a/inc/page.php +++ b/inc/page.php @@ -22,6 +22,8 @@ class Page { $this->lang = new en_US(); } + $this->formatter = new IntlDateFormatter($settings->lang, IntlDateFormatter::LONG, IntlDateFormatter::NONE, $this->settings->timezone, IntlDateFormatter::GREGORIAN, $settings->date_format); + $this->conn = $settings->conn; $this->settings = $settings; $this->uuid_name_cache = array(); @@ -394,8 +396,7 @@ class Page { */ function millis_to_date($millis) { $ts = $millis / 1000; - $formatter = new IntlDateFormatter($this->settings->lang, IntlDateFormatter::LONG, IntlDateFormatter::NONE, $this->settings->timezone, IntlDateFormatter::GREGORIAN, $this->settings->date_format); - $result = $formatter->format($ts); + $result = $this->formatter->format($ts); $translations = $this->settings->date_month_translations; if ($translations !== null) { foreach ($translations as $key => $val) {