From 865ecc87963dc3b26e66296616eef2a1cc41ac3f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 25 Oct 2023 12:55:09 +0300 Subject: move to psr-4 autoloader --- classes/timehelper.php | 89 -------------------------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 classes/timehelper.php (limited to 'classes/timehelper.php') diff --git a/classes/timehelper.php b/classes/timehelper.php deleted file mode 100644 index 453ee0cee..000000000 --- a/classes/timehelper.php +++ /dev/null @@ -1,89 +0,0 @@ -getOffset($dt); - } else { - $tz_offset = (int) -($_SESSION["clientTzOffset"] ?? 0); - } - - $user_timestamp = $dt->format('U') + $tz_offset; - - if (!$no_smart_dt) { - return self::smart_date_time($user_timestamp, - $tz_offset, $owner_uid, $eta_min); - } else { - if ($long) - $format = get_pref(Prefs::LONG_DATE_FORMAT, $owner_uid); - else - $format = get_pref(Prefs::SHORT_DATE_FORMAT, $owner_uid); - - return date($format, $user_timestamp); - } - } - - static function convert_timestamp(int $timestamp, string $source_tz, string $dest_tz): int { - - try { - $source_tz = new DateTimeZone($source_tz); - } catch (Exception $e) { - $source_tz = new DateTimeZone('UTC'); - } - - try { - $dest_tz = new DateTimeZone($dest_tz); - } catch (Exception $e) { - $dest_tz = new DateTimeZone('UTC'); - } - - $dt = new DateTime(date('Y-m-d H:i:s', $timestamp), $source_tz); - - return (int)$dt->format('U') + $dest_tz->getOffset($dt); - } - -} -- cgit v1.2.3