1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 03:04:09 +02:00

[feature/new-tz-handling] Sort timezones in selector by offset.

Since the list of timezones is very long, and users are likely
to know their current offset but not necessarily which city
that is nearby is in the timezone database, sort the list of
timezones by offset.

UTC is specially handled to show up before other GMT+0 timezones.

PHPBB3-9558
This commit is contained in:
Oleg Pudeyev
2011-03-10 19:14:53 -05:00
parent f17664a00c
commit bb461c8daa
2 changed files with 71 additions and 10 deletions

View File

@@ -256,15 +256,7 @@ function feed_format_date($time)
global $user;
$zone_offset = $user->create_datetime()->getOffset();
$sign = ($zone_offset < 0) ? '-' : '+';
$time_offset = abs($zone_offset);
$offset_seconds = $time_offset % 3600;
$offset_minutes = $offset_seconds / 60;
$offset_hours = ($time_offset - $offset_seconds) / 3600;
$offset_string = sprintf("%s%02d:%02d", $sign, $offset_hours, $offset_minutes);
$offset_string = phpbb_format_timezone_offset($zone_offset);
}
return gmdate("Y-m-d\TH:i:s", $time + $zone_offset) . $offset_string;