Hi,
I encountered a problem with the calender of Drupal. Bear in mind I am a newbie with some programming background (25 years). I have to say that PHP is new for me. I am studying it for several months now.
The problem
I saw that the current day on the calender was 1 day ahead. It was after 10 o'clock local time so I expected it to be a timezone problem. I checked it and the timezone was OK. I must be +0200 hour to match my local time. So no solution there.
So I searched for the code. I found the code in the Archieve Module. This is the code:
// Extract today's date:
$offset = time() + $user->timezone;
$start_of_today = mktime(0, 0, 0, date('n', $offset), date('d', $offset), date('Y', $offset)) + $user->timezone;
$end_of_today = mktime(23, 59, 59, date('n', $offset), date('d', $offset), date('Y', $offset)) + $user->timezone;
I noticed that the variable $offset contains the timezone difference added to the time. Right? If we take a closer look you can see that $start_of_today contains ruffly the $offset (time + timezone remember?) and the timezone is added again. That is 2 times the timezone. Right? The same counts for the variable $end_of_today.
If I am correct that means with a timezone of 0200 hours in this case the time will be +0400 hours. Correct? I corrected it by removing the first $user->timezone.