Closed (won't fix)
Project:
Calendar
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Apr 2007 at 05:15 UTC
Updated:
5 Sep 2008 at 14:17 UTC
When a view via a calendar is presented, any items that show a "short time" in the day associated with that node, in the calendar-month show incorrect times for those events, as those events are not passed via format_date() but rather via gmdate().
This obviously results in users seeing the wrong times for events (however the correct date is shown for that event)
--- calendar.module 2007-03-08 07:54:26.000000000 -0800
+++ fixed 2007-04-10 22:08:41.000000000 -0700
@@ -433,9 +433,9 @@
// format a time-only display for the month calendar for dates that have time elements
if (array_intersect($granularity, array('H', 'N', 'S'))) {
- $node->start_time_format = gmdate(variable_get('calendar_time_format_'. $view->name, 'H:i'), intval($node->calendar_start + $node->start_offset));
- if ($node->calendar_end) $node->end_time_format = gmdate(variable_get('calendar_time_format_'. $view->name, 'H:i'), intval($node->calendar_end + $node->end_offset));
- }
+ $node->start_time_format = format_date($node->calendar_start,'custom',variable_get('calendar_time_format_'. $view->name, 'H:i'));
+ if ($node->calendar_end) $node->end_time_format = format_date($node->calendar_end,'custom',variable_get('calendar_time_format_'. $view->name, 'H:i'));
+ }
else {
$node->start_time_format = $node->start_format;
$node->end_time_format = $node->end_format;
this patch uses format_date so the user see's the correct time for the event/node according to their and system wide preferences
| Comment | File | Size | Author |
|---|---|---|---|
| calendar-time-show.patch | 1.08 KB | dgtlmoon |
Comments
Comment #1
dgtlmoon commentedAre there many other potential issues with this module as it never uses format_date() , or am i going about it the wrong way?
Comment #2
dgtlmoon commentedComment #3
karens commentedThe module doesn't use format_date because format_date() won't handle pre-1970 dates, which this module will handle, so there is a date_format_date() alternative. Using gmdate() in various places is a trick to keep the system from trying to inject the server timezone adjustment into its results, which is what will happen if you use date(). This is necessary because we're trying to control the timezone adjustment separately so we can properly handle things like a hosted server in timezone A and a site default of timezone B and a user in timezone C. And even with that, we have a problem because we don't currently have any way to know the user's zone, we only know their current offset, assuming they've corrected it, and applying that offset to events on other dates may or may not produce the right results. The ultimate solution is to track the actual timezone for users if we want to adjust prior or future dates properly for user time.
That said, there are many many places in the code where timezones can get goofed up. I'm in the process right now of a major re-write of the code to try to simplify, find, and fix these things. The rewrite will probably be 5.x and up only, but I'm going to try to come back here and make changes to the 4.7 version as I find things.
So this is not fixed yet, but not forgotten.
Comment #4
karens commentedFinally found the source of this problem. It was not anything to do with the way the code is adjusting timezones, it was that it was using the offset field name instead of its value to make the offset. Since the field name has no value, all dates were showing up as if they were in GMT.
Comment #5
dgtlmoon commentedgood work!
Comment #6
(not verified) commentedComment #7
dgtlmoon commentedalso related http://drupal.org/node/184756
Comment #8
dgtlmoon commentedSorry all, this issue appears to be open again :(
I cant get the latest snapshot or rc2 to display any data in the calendar
So as of calendar-5.x-1.7.tar.gz the calendar is still showing the nodes as they would be according to the sites local time
Comment #9
karens commentedI'm not making changes to the 5.1 version. I'm officially recommending you move to the 5.2 version now. If you have problems in that version you can check for existing issues or add new ones. Feature requests are now getting posted to the D6 version to be back-ported to 5.2.
See what, if anything, is still a problem in 5.2.