Calendar off by a day

Calendar off by a day

by James Strohmaier -
Number of replies: 16
I tried to find the answer to this here but no one seems to have this problem. My calendar is off by a day. In other words, my calendar has the month of February starting on a Monday (instead of a Tuesday), so for me, today reads Tuesday, February 23 instead of Wednesday, February 23. This doesn't strike me as a location problem because the 23rd should fall on a Wednesday all over the world, right? And yes, my whole calendar is off, not just Feb.
Average of ratings: -
In reply to James Strohmaier

Re: Calendar off by a day

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Have you set the timezone correctly in

  - Admin >> Configure >> Variables
  - your user profile ?
In reply to Martin Dougiamas

Re: Calendar off by a day

by James Strohmaier -
Yes, my timezone is correct. This doesn't appear to be a time zone problem. It's like looking at the 2004 calendar. The days just don't match up. While it may be Tuesday, February 22 in America at the same time it's Wednesday, February 23 in Asia (where I live), it's still going to be the same day and date regardless. My problem is my calendar says it's Tuesday, February 23. All of my dates are off by one day. For example, March 1, 2005 falls on a Tuesday, but on my calendar, it falls on a Monday. This means that any assignments I link up to the calendar will have to be explained to students (Sorry, don't think about the day of the week, just focus on the date...etc.). No one else seems to have this problem. Check my page out. I just now registered it.
In reply to James Strohmaier

Re: Calendar off by a day

by John Papaioannou -
Hi James,

Can you provide us with some more data, please? Specifically:

  • Version of Moodle
  • Version of calendar/lib.php (it's in the comment in the first line)
  • Server's physical location (its timezone interests us)
  • Moodle configuration setting: timezone
  • User's profile setting: timezone (for the user account which sees the problem)

Thanks!
Jon
In reply to John Papaioannou

Re: Calendar off by a day

by James Strohmaier -

Joe,

1. Moodle Ver. Moodle 1.4.3 + (2004083134)
2. calendar/lib.php: I'm not really sure where to look for this. In the server?

3. Server's physical location is Pusan, South Korea (Pukyong National University)

4. Configuration setting for timezone: Thurs., 12:59 p.m. (GMT+9)

5. I'm not sure about the user's profile setting for timezone. Maybe that's what I have for question 4

Once again, I'm not really sure what the timezone has to do with this. For me, in Korea, today is Thursday, February 24. It may be Wednesday, February 23 in your neck of the woods, but tomorrow it will be Thurs. the 24th. On my calendar, it is Wednesday the 24th.

 I'm getting the sense that this is a server problem, yes? So Moodle calendar is pegged to some internal clock in my server, and in order to fix this I'm going to have to get my server admin to monkey around with the setting for the server. Sound about right?

In reply to James Strohmaier

Re: Calendar off by a day

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Yes, very strange.

Can you make try some forum postings and check the date displayed for them?

  1. If these are having the same problem as the calendar then something is very wrong on the server.

  2. If those dates are OK and only the calendar is wrong then we have a bug of some kind that no-one else has found before and Jon really needs to look at it. tongueout
In reply to Martin Dougiamas

Re: Calendar off by a day

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I can see the problem on your site and it is just the calendar ... very strange because if you look at this site (running a similar version in a similar timezone GMT+8) it works fine.

Can you please have a look at the file calendar/lib.php (on the server, yes) and tell us what the version info in the first line says ...?
In reply to Martin Dougiamas

Re: Calendar off by a day

by James Strohmaier -

Yes, I will contact my server admin tomorrow (it's close of business time here) to have a look at the version of calendar/lib.php. I had a feeling this was a problem on our end. Thanks for all of your help. I'll post the results tomorrow.

In reply to Martin Dougiamas

Re: Calendar off by a day

by James Strohmaier -
One thing that might be the culprit: the 2004 leap year. I went to last year's calendar thinking perhaps the wrong year was loaded into our system, or something, but last year, Feb. started on a Sunday (my Feb. begins on a Monday). I'll just bet this has something to do with the fact that 2004 was a leap year. Weird, huh?
In reply to Martin Dougiamas

Re: Calendar off by a day

by John Papaioannou -
Actually I think this is a problem we have had before and that Jon looked at but came away empty-handed... mixed

If I 'm not mistaken, that case was also in Korea, GMT+9. This cannot be a coincidence. The trouble is, unless somehow we can duplicate it, there's not a thing we can do.

Maybe if we got an SQL dump with enough data... but that would be hard to arrange.
In reply to John Papaioannou

Re: Calendar off by a day

by John Papaioannou -
I found another case of this in my backlog... bug 2410. Seems to be the same, but again, could not reproduce.
In reply to John Papaioannou

Re: Calendar off by a day

by Tim Allen -
Hi Jon,

I'm also in Korea  GMT +9, but I don't have this problem, in either 1.4.3 or 1.5 dev.  thoughtful

I am running my own server (Fedora Core 3).

Tim.
In reply to Martin Dougiamas

Re: Calendar off by a day

by John Papaioannou -
Argh...

I think someone else was having this exact problem some time ago. The problem is, I couldn't reproduce it then, and I cannot reproduce it now. Setting my timezone to GMT+9 didn't help any.

I 'll sleep on it. Martin, if you get any sudden flashes of light... wink
In reply to James Strohmaier

Re: Calendar off by a day

by John Papaioannou -
I think I got it! big grin

You will need to test this for us though. It will require a small modification to one of the Moodle source files. However, it's very simple to make and it it also risk-free, it will definitely not make things worse. I am hopeful that it will fix the bug, though. smile

In calendar/lib.php, find the line which reads:

$startwday = gmdate('w', $display->tstart);

(this is line 100 in my copy of the latest 1.4.x, it should be the same or very near that in your copy)

Change the line to:

$startwday = date('w', mktime(12, 0, 0, $m, $d, $y, 0));

...and hopefully visit your Moodle to find the problem fixed. Can you do that?

Jon
In reply to John Papaioannou

Re: Calendar off by a day

by John Baldassarre -

I had the same problem with it so I tried this fix. Now all my months start on Sunday with the 1st of the month. So April 1st is a Sunday. May 1st is a Sunday etc.

In reply to James Strohmaier

Re: Calendar off by a day

by Sharon Gray -

We've actually begun having a similar problem, but with an even stranger twist:  For one user, the calendar presents one day off. For everyone else, it appears to be working correctly. I tried logging in at different computers, but still have the same problem. The only unique thing about this user that I can determine is he was one of the first people we put into the system. But, the admin account is working fine (and it would have been created early on, too.)

So, any insights or ideas would be appreciated!

Sharon Gray, Augustana College, Sioux Falls, SD

In reply to Sharon Gray

Re: Calendar off by a day

by Sharon Gray -

Hi, Folks. I'm replying back to my original post because the "time zone" answer turned out to be the trick!  I wanted to make sure anyone else encountering the problem knows to look into this.

For some reason, that one user had his profile set to our actual timezone while everyone else was set to "server's local time."  When we changed his profile to "server's local time", the calendar showed the correct dates!

Sharon