From 04d83edd361475087ee6e24b317e5be4d03f08b1 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Tue, 22 Aug 2023 18:52:13 -0600 Subject: [PATCH] app: fix `getMySQLTimezoneOffset()` truncating seconds Previously the `getMySQLTimezoneOffset()` function would truncate the seconds part of a time offset (returning `+9:00` instead of `+9:30`) for example. This only affects timezones with offsets that contain minutes. Closes https://github.com/pterodactyl/panel/issues/4821 Superseeds https://github.com/pterodactyl/panel/pull/4827 Co-authored-by: danny6167 --- app/Helpers/Time.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/Helpers/Time.php b/app/Helpers/Time.php index e8e585c2b..dde70bbc5 100644 --- a/app/Helpers/Time.php +++ b/app/Helpers/Time.php @@ -15,8 +15,6 @@ final class Time */ public static function getMySQLTimezoneOffset(string $timezone): string { - $offset = round(CarbonImmutable::now($timezone)->getTimezone()->getOffset(CarbonImmutable::now('UTC')) / 3600); - - return sprintf('%s%s:00', $offset > 0 ? '+' : '-', str_pad((string) abs($offset), 2, '0', STR_PAD_LEFT)); + return CarbonImmutable::now($timezone)->getTimezone()->toOffsetName(); } }