Directory

phpBB • Blog • Development Update: Timezones in Ascraeus

Blog

Development Update: Timezones in Ascraeus

Posted by naderman in Development with the tags , on November 5th, 2013

This week we saw many smaller bugfixes and improvements. One of these changes was to ensure timezones in phpBB 3.1 can be translated correctly. So I picked an explanation of our timezone handling for this week’s blog post.

In phpBB Olympus 3.0 we provide the user with a list of UTC offsets and a corresponding timezone name. In addition to the timezone a user can select whether DST (Daylight Saving Time) or Summer Time, as it is called in other places, currently affects them. If the DST option is selected the UTC offset is increased by one hour. I live in Germany so I select “[UTC + 1] Central European Time, West African Time”. In the spring I have to check the DST box and in the fall I deselect it. This results in UTC+2 in the summer and UTC+1 in the winter.

Clearly it is annoying for users to have to switch their timezone settings twice every year. Most users will probably not bother to change DST if they are even aware of the option to begin with. Users may also be unfamiliar with the name of their timezone or the corresponding UTC offset. So back in 2010 Chris Smith (ToonArmy) proposed an alternative approach to handling timezones in the Switch to PHP timezone handling RFC on our Area51 development community.

In this example my current timezone is set to Europe - Berlin where the current time is 1:40 am. However I am currently in New York City so phpBB suggests I update the timezone to match my local time which is UTC-5.

In this example my current timezone is set to Europe – Berlin where the current time is 1:40 am. However I am currently in New York City so phpBB suggests I update the timezone to match my local time which is UTC-5.

In phpBB Ascraeus 3.1 we now offer a much longer list of timezones grouped by continent and identified by cities and countries in these continents. Each timezone selection includes information on when DST applies in the respective location so users no longer have to manually select whether DST applies to them. As this list contains around 500 different options we allow the user to first select the current local time and then reduce the options to all those timezones which actually match the user’s current time. So user’s really only have to pick what time it is at their current location anymore. We use JavaScript to guess which timezone the user is most likely in, based on the browser’s reported timezone. On upgrading from Olympus the UTC offset is retained until the user selects a different timezone.

Further pull request 1812 added a new type of notification which informs administrators of newly registered users if the community requires admin activation. This makes use of our new notification system, so the notification will be appear in the forum’s header and be available via email and/or XMPP.

Click here to comment on this blog post or to view additional comments