Hello. Throughout running Drupal for the last 3 years, I've consistenly run into issues with Timezone handling in one form or another. In some versions, it just plain has been broken and I've hacked the code to correct it and has been extremely inconsistent. In others, it's mostly fixed, but modules misbehave when handling timezone calculations.

In addition, it appears no module or time functions in Drupal make any account for Daylight Savings changes. I have to go change the site wide timezone settings to reflect the changes (eg GMT -7 becomes GMT -8, then back to GMT -7). I'm fairly certain that there must be code out there that calculates the Daylight Savings change dates, and could be applied to the logic.

I'm curious if it would make sense for a full blown new core module to be put in place ... or somewhere in the existing core ... for a full API to Timezone handling. This way any module that wants to touch a time string doesn't have to do it. Then time can be managed and applied in a consistent fashion. If such a function already exists, I would hope that existing modules that muck with TZ settings are corrected? Particularly the event.module.

I'm not certain if this has happened to a degree ... seeing in 4.5.2 and 4.6.0 the "user configurable timzeon" options seems like it's a beginning.

I run a bunch of websites whereby the Event module is an integral component. It definitely seems to be one of the biggest offenders of timezone mucking.

Am I off base here, or is this just a localized problem to event module? Thoughts? Thanks!

I apologize if this is a duplicate type posting. I did do some searches, but didn't find anything relavent offhand.

Comments

inertia@heterotopias.org’s picture

me neither.

I found no relavent offhand. In my case, calander, event, is the server local time but default site timezone i had set, but rss time is GMT. it makes my event +12 hours offset and rss time go +8. My religon is on GMT +8, and my server local time is GMT -4. As the RSS, one thing I really wonder, when I pull down to choice a timezone, it's not the GMT +offset, it give the choices that my local time +offset, does it matter?

sepeck’s picture

Timezone is a known issue. There are some open in Drupal bug track I believe. Killes proposed one patch as a solution. Timezone issues are complicated. I would suggest you go through the bug tracker/feature requests and then comment appropriately there.

Also, I remember some discussion on drupal-devel mailing list so you might browse the archives there. I am sure that everyone would welcome work on the issue.

-sp
---------
Test site...always start with a test site.
Drupal Best Practices Guide

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

martinlanghoff’s picture

Faced with similar problems, the Moodle project (http://moodle.org/) developed a simple yet complete set of functions that handle TZ, DST, etc. This library handles time conversions correctly for dates in the past where the DST rules were different from today.

The key files are olson.php which parses the Olson zoneinfo database files, and moodlelib.php (functions userdate(), usetgetdate(), calculate_user_dst_table(), dst_changes_for_year() and dst_offset_on()).

Links:

ViewCVS view of the directory where olson.php and moodlelib.php reside:
http://cvs.sourceforge.net/viewcvs.py/moodle/moodle/lib/

Olson Zoneinfo files
ftp://elsie.nci.nih.gov/pub/

Discussion of the Olson parsing, TZ handling, etc:
http://moodle.org/mod/forum/search.php?search=olson&id=5

Perhaps this is useful. The code is naturally under GPL license and in PHP, and developed by Jon Papaionnaou and me. Widely tested on several platforms.

cheers,

martin

shane’s picture

Martin - Thanks for posting this info! Hopefully someone in the Drupal team that's been battling the TZ issues will find this code useful and reusable. You have to love Open Source when various projects are willing/interested in sharing code to ease each other's burdens. Keep rockin' the free world! Thanks to all Drupalers, Moodlers, and the ba-zillion other open sourcers!