Closed (fixed)
Project:
Calendar
Version:
5.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Nov 2006 at 20:35 UTC
Updated:
14 Jul 2012 at 19:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
karens commentedThis is related to a long-standing bug in the event module that displays dates one day off in the calendar. I tried to compensate for that problem but haven't yet found quite the right solution. I need to know the following:
1) What timezone is your site set to?
2) What timezone is set in your user profile?
3) What timezone is your server using? (if you host your own web site, it's probably the same as your site. If you are on a shared host, it will be the timezone where your host is located).
Comment #2
mikey_p commentedI'm getting the same error, but only in the EVENT view such as drupal/event or the calendar event block. The view at drupal/calendar is fine.
My timezone is set to GMT -0800 and date_default_timezone is set to '-28800'.
User timezones is disabled.
This is off my localhost which is set to the same timezone (GMT -0800).
I don't know if the version of Event I'm using is relevant, but it's the latest head, v 1.215 2006/12/17.
-Mike
Comment #3
mikey_p commentedFurther, I've noticed that it's only part of the day, seemingly the first half. I haven't noticed exactly when the it changes to being a day ahead in the event views, but at say 0800 hours, it's fine, and when i've checked it at 1800 or 2200, the event calendar view is highlighting the next day, while the regular calendar view does not.
Comment #4
davidjmcq commentedSame problem: V.5, calendar 5.x-1.0-beta downloaded a couple of hours ago,
Calendar page view
timezone: Wednesday, 10 January, 2007 - 18:49 +1100
server host clock: 18:49 timezone Sydney (+1100)
client is also server.
calendar shows 11th.
Comment #5
amanire commentedI have the same problem and I'm not using the event module. It's two days ahead for me, though.
Comment #6
gordon commentedI am having the same issue at a site, but in the morning it is correct, and the afternoon, it is ahead 1 day.
Check http://homemods.info/training/calendar
Thanks
Comment #7
karens commentedI just made some commits that I hope will fix this. You can reopen if not. You can get the commit from the cvs repository or wait for the nightly snapshot to update tonight.
Comment #8
karens commentedComment #9
gordon commentedThanks for this, Can you backport the changes to 4.7?
Comment #10
karens commentedAll branches were updated.
Comment #11
gordon commentedThanks, but I am still having the issue on the 4.7 branch in the afternoon (Australian EST +10:00) where the calendar will list the date as being tomorrow.
Comment #12
karens commentedDang it. The event module has the same problem, and there is an issue there that has gone on forever with various solutions that ended up not working. I tried my own solution here which fixed some problems, but apparently not all.
So I guess this is still an open issue :-(
Comment #13
chrissearle commentedIf you want another example :) - same issue here - (5.x) all timezones are GMT+1 (that is site and node date fields) - the server is running on GMT. Events not installed - this is on calendar view
Comment #14
lbn.kiev.ua commentedwell, looks like I solve this problem... try this:
replace function calendar_user_date (in modules/calendar/calendar_api.inc) to this one:
at least, for my timezone (+2:00) it works correctly
Comment #15
mikey_p commentedhere's the previous follow up in patch form. I'll have to wait until tomorrow afternoon to fully test it.
Comment #16
appel commentedSeems to have worked for me. Thanks!
Comment #17
chrissearle commentedYep - here too.
Comment #18
karens commentedWell my solution wasn't working, so we'll give it a try. Thanks! Patch committed to all branches.
Comment #19
mikey_p commentedsorry to be away for so long, but patch from #14 has no change for me
Comment #20
karens commentedThis has been committed, it is no longer a patch. Did you try this on the latest version after the patch was committed? If so and it still does not work, more info is needed since this is working for other people, including me.
What timzone are you (the user) set to? Double check your user record to be sure. I thought I had not set up a timezone for myself but it got set to GMT when I made another change to my user record, which screwed me up until I figured it out.
What timezone is the server set to?
What timezone have you set up your drupal site to use as the site timezone?
Comment #21
mikey_p commentedTimezone is set to GMT -800, date_default_timezone is "-28800" Configurable time zones is disabled, and enabling it and setting it to the same value for the user results in no change.
From the server date, echos the correct time labeled as PST, which correleates to the -800 setting in drupal and "-28800" as in date_default_timezone. Result is same when tested from localhost.
Site is at http://mikeyp.net/drupal-5.1/ see blocks in left hand column for example. Current site code can be found at http://svn.mikeyp.net/public/mikeyp.net/trunk/drupal-5.1/ and you can login as admin/admin at site and devel is enabled to check the various timeone variables if you wish.
Hope this helps, I've grabbed the latest HEAD of calendar and event, and this is still occuring. Is there anything else you need to know to check this out?
-Mike
Comment #22
Bud Wellington commentedI'm in the -6:00 timezone. The date seems to be changing about 10:00 pm... but it may be happening earlier. I'll try to catch the moment if I can. If there's any information I can provide that would be helpful, please let me know. Thanks.
Comment #23
karens commentedReported again at http://drupal.org/node/175787. This is probably not going to go away until I get the new Date API completely functional since this is a timezone conversion issue and the new API is designed to address that.
Comment #24
karens commentedAnother report at http://drupal.org/node/147386 has some useful research into reasons why, but the ultimate fix for this will be the new Date API.
Comment #25
karens commentedAlso reported at http://drupal.org/node/138397.
Comment #26
jvalletto commentedKaren,
I'm wondering if a temporary fix could be applied for the current dev version. I was searching myself for a way to fix it temporarily, and seemed to have found a good fix.
Change:
To:
Sorry it's not in a patch, have no experience with creating those.
Again, it seems to work for me, whether configurable user timezones are on or off.
Thanks,
Jeremy.
Comment #27
bkenro commentedI also encountered a similar behavior (node's date and today's highlighing being off) when I created a simple calendar view without creating any date field.
I used:
Drupal 5.3
Views 5.x-1.6
Calendar 5.x-1.7
Date 5.x-1.7.
xampplite 1.6.2 for Windows (Apache 2.2.4, MySQL 5.0.45, PHP 5.2.3)
In this situation, variable_get() in line 227 of calendar.module seems to fail to get the value of 'date_default_timezone_name' because there's no corresponding record in the 'variable' table.
As a result, $timezone varible always get to be 'UTC' and the calendar displays the dates on the assumption of GMT.
After adding a date field to any data type (for example, Page or Story) and setting the "Site timezone:" parameter to my own in the setting page of the date field, it was reflected on the $timezone value and the problem was solved.
In addition, when I added another date field somewhere and set its "Site timezone" parameter to a different value, the new value was also reflected on the first date field's setting. It seems that the default timezone is only based on the 'date_default_timezone_name' record in the variable table, and it has no relation to the site's timezone (set in /admin/settings/date-time) nor the date.timezone value in php.ini.
I think this behavior is somewhat confusing and I guess it may be one of the causes of the problem if similar situation.
Comment #28
bkenro commentedCorrection
Previous post did not have direct relation to the today's highlighting problem.
I could finely solve the problem by #26 (thanks!), but not by above operation.
It only solves the display of node's dates in the same situation (not today's highlighting).
Sorry for confusion.
Comment #29
jvalletto commentedI'm going to mark this RTBC, as it seems to work pretty well for the above issue, without causing any noticeable problems.
Comment #30
NewZeal commentedI solved the problem using the code from #14 but with time() instead of calendar_user_time() since that is the server time and calendar_user_time() does not exist in this version.
Thanks ibn.kiev
Comment #31
johnalbinJeremy, thanks for pointing us in the right direction! That's definitely a working solution.
However, it's bad form to mark your own patches as RTBC. Let someone else review it and mark it RTBC. Especially since there was a bug in your code. ;-)
I borrowed the timezone offset code from
calendar_event_date(), so this should work with the various tz options.(Also, I changed 3 tabs into spaces.)
Comment #32
jvalletto commentedSorry. My bad. Never done this type of thing before, but I'm glad I could at least point you in the right direction.
Jeremy.
Comment #33
james.t commentedi kind of have a similar problem as this but it's not only the "Today" date but it's also when i setup an all day event from ical it spans over two days
If something is happening on the 13th and marked an all day event it goes from the 13th to the 14th and is marked as all day for both days.
Is there any fix for that?
Comment #34
llslim commentedI had the same problem and solved it with the following 2 lines of code which does the same as the patch of johnAlbin in #31 but in a more compact way without the redundant user uid check. Whole calendar_user_date function to follow.
Hope this helps.
Comment #35
johnalbinI believe the patch to the date_time() function in date module's issue queue will fix this issue: http://drupal.org/node/206009
Comment #36
karens commentedThis is fixed (I think) in the 5.2 versions of Date and Calendar.
Comment #37
WisTex commentedI have the latest stable releases for calendar, date, etc., and it is not fixed. Calendar still thinks the time of day is GMT, despite settings in Drupal otherwise. A perfect example of the problem is after 6 p.m., the calender says it is tomorrow, because we are GMT -6 and 6 p.m. is midnight GMT.
This also effects Views as well. And the documentation is not clear on how to specify "Now minus 6 hours" or "Now GMT - 6" to rectify the problem without recoding the module.
A patch for the Date module has been submitted (http://drupal.org/node/206009) but that appears to be pending inclusion as of this posting.
Comment #38
WisTex commentedI had a similar problem. What that turned out to be is the time zone in your profile was not the same time zone you were in. So the calendar was nice enough to adjust the times to your time zone, which I am not sure is how it should work, especially since events are typically at a specific location with a local time zone (unless they are virtual events).
How I solved that particular problem was by going into my user profile while logged in and changing my time zone (My Account | Edit). Also, make sure Drupal's time zone is set to the correct time zone as well (Administer | Date and Time).
Now that won't fix the problem of the Calendar using GMT, but that will fix the problem of the events having the wrong times for events that you added yourself. iCal events appear to always use GMT, which means they are always 6 hours off in my case. I cannot use the iCal module as a result. Not sure if that is related to the same problem that causes the calendar to display in GMT only.
Comment #39
johnalbinKaren, I’m hoping this is fixed in 5.x-2.x as well.
But since that is un-released (not even a beta release), you should leave this issue open. And, in my opinion, if its going to be a while before 5.x-2.x is released, this issue should get fixed in the 5.x-1.x branch.
Comment #40
john bickar commentedSubscribing
Comment #41
dgtlmoon commentedstill active in 1.7x
Comment #42
nickco commentedHas anyone looked at themeing this in template.php? For my calendar, The dates display properly on the node or in the list/ teaser views but not on the calendar. This theme gets called what about just setting the date by refrence?
function mytheme_date_display_combination($field, &$dates, $node=null)
{
}
Comment #43
nickco commentedHas anyone looked at themeing this in template.php? For my calendar, The dates display properly on the node or in the list/ teaser views but not on the calendar. This theme gets called what about just setting the date by refrence?
function mytheme_date_display_combination($field, &$dates, $node=null)
{
if(arg(0) == 'calendar') {}
}
Thanks!
Comment #44
Mukesh Dubey commentedHi,
I am using application based on struts. In this, display time block 8:00AM to 5:30 PM in which we take appointment.I have to implement Time Zone(GMT) .
When any body working late (9pm, 10pm, etc), then available time blocks on the search page for earlier times in the day (6pm, 7pm, etc), times that have actually already passed. We want to make sure we correctly display available time blocks.
I am in Asia/Calcutta Time Zone Id.
Waiting for reply.
Thanks,
Mukesh
Comment #45
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.
Timezone handling is much improved in 5.2.
Comment #46
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.