1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-05 08:17:47 +02:00

[feature/new-tz-handling] Remove code using legacy timezone properties.

Code accessing the legacy user::$timezone and user::$dst properties
has been removed and replaced with code utilising user::create_datetime().

Changed by Oleg:

in viewtopic, memberlist and index use getTimestamp() + getOffset().

We show members that have birthdays on the specified date.

getTimestamp() returns the current date in UTC. We add getOffset() to
obtain the current local time in the viewing user's timezone.
Then we find members having birthday on this date.

Changed by Oleg again:

Take leap year status out of the datetime object we have, this seems
like it should work as one would expect.

PHPBB3-9558
This commit is contained in:
Chris Smith
2010-07-07 23:42:54 +01:00
committed by Oleg Pudeyev
parent af789040b8
commit 1665434853
5 changed files with 14 additions and 8 deletions

View File

@@ -555,9 +555,12 @@ class custom_profile
else if ($day && $month && $year)
{
global $user;
// Date should display as the same date for every user regardless of timezone, so remove offset
// to compensate for the offset added by user::format_date()
return $user->format_date(gmmktime(0, 0, 0, $month, $day, $year) - ($user->timezone + $user->dst), $user->lang['DATE_FORMAT'], true);
// Date should display as the same date for every user regardless of timezone
return $user->create_datetime()
->setDate($year, $month, $day)
->setTime(0, 0, 0)
->format($user->lang['DATE_FORMAT'], true);
}
return $value;