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 <daniel@barteck.com.au>
This commit is contained in:
parent
15860613b6
commit
04d83edd36
1 changed files with 1 additions and 3 deletions
|
@ -15,8 +15,6 @@ final class Time
|
||||||
*/
|
*/
|
||||||
public static function getMySQLTimezoneOffset(string $timezone): string
|
public static function getMySQLTimezoneOffset(string $timezone): string
|
||||||
{
|
{
|
||||||
$offset = round(CarbonImmutable::now($timezone)->getTimezone()->getOffset(CarbonImmutable::now('UTC')) / 3600);
|
return CarbonImmutable::now($timezone)->getTimezone()->toOffsetName();
|
||||||
|
|
||||||
return sprintf('%s%s:00', $offset > 0 ? '+' : '-', str_pad((string) abs($offset), 2, '0', STR_PAD_LEFT));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue