Currently we store UTC UNIX timestamps of every entity which has an attached date and time, and convert these to the users timezone and localise them when the page is rendered using user::date_format(). This poses two notable shortcomings:
- Users and administrator has to manually adjust the timezone when DST changes
- Timezone information on the entity is lost
Tackling of this problem basically falls into two distinct sets of changes, first the user timezone handling should use the PHP DateTime(Zone) classes. Secondly entity columns should be modified to include the timezone so that differences can be calculated correctly.
- Firstly all the phpBB date formatting code should be ported to work inside the DateTime::format() method, thus all phpBB DateTime's will be formatted correctly by default.
- The existing user_timezone and user_dst columns will be dropped and replaced with a varchar user_timezone column containing the textual timezone identifiers. Existing settings will be converted to the Etc/±X timezones.
- The board_timezone and board_dst configuration options will be deleted and the user prompted to enter a new default timezone on upgrade - stored in board_timezone.
- user::format_date() will continue to act as a legacy wrapper to format UTC UNIX timestamps using the new DateTime class.
- A method will be added to the user class to instantiate a DateTime object in the users timezone and locale.
This will probably be deferred to a second RFC for 3.2 but basically existing integer types for UNIX timestamps on various tables will be adjusted to either a database specific timezoneless datetime data type or a text column for an ISO-8601, and an additional column for the timezone identifier will be added. Existing times will be stored in the new columns as if there were created at UTC.
First patch: https://github.com/p/phpbb3/compare/dev ... z-handling