[RCD] Timezone setting
roundcube at gmail.com
Wed Jan 4 13:56:38 CET 2012
I now refactored timezone handling in Roundcube (see
http://trac.roundcube.net/changeset/5707) to add proper timezone support to it.
The big change is that $rcmail->config->get('timezone') no longer returns
an integer value with the timezone offset in hours but the timezone
identifier as string. That one can be used to create a DateTimeZone object
for date calculation or formatting.
Plugin developers who made use of the 'timezone' config property therefore
need to adjust their code. With this change, the 'dst_active' config option
no longer exists.
I hope this helps to make date calculations easier for the future.
Thomas Bruederli wrote:
> On 05.12.2011, at 16:21, Roland Liebl wrote:
>> Hi Devs,
>> I'm currently implementing Timezone support in my calendar plugin.
>> I think this should be integrated with Roundcube Timezone settings.
>> Is there a special reason why you save only the offset and DST
>> in prefs?
> There's no special reason but just historic stupidness. Up until now it was enough because the only purpose of the timezone setting was to translate email dates to display.
> I also worked on a calendar plugin and came across the same problems. To get one step closer we meanwhile distinguish between Timezone and DST which allows you to select a timezone from the Olson database using the these two offsets:
> $timezone = $this->rc->config->get('timezone');
> $dst_active = $this->rc->config->get('dst_active');
> $gmt_offset = ($timezone + $dst_active) * 3600;
> $user_timezone = new DateTimeZone($timezone ? timezone_name_from_abbr("", $gmt_offset, $dst_active) : 'GMT');
> Feel free to make the necessary changes to the Roundcube core in order to have a proper timezone support. You will, however, face some difficulties when one uses "automatic" setting and the timezone has to be taken from the client browser. There we only have very limited means of reading the actual timezone settings.
List info: http://lists.roundcube.net/dev/
More information about the Dev