]> git.mjollnir.org Git - moodle.git/commitdiff
Bug #5991 - The calendar does not show the month's first day's event; merged from...
authorskodak <skodak>
Mon, 3 Jul 2006 09:10:12 +0000 (09:10 +0000)
committerskodak <skodak>
Mon, 3 Jul 2006 09:10:12 +0000 (09:10 +0000)
calendar/lib.php

index fe5c126537b76b86fbe1b07fddb4d6f8de1b40cf..bf077d10a6a26db7d471e536aa4fb91f8439a728 100644 (file)
@@ -104,9 +104,15 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
     list($d, $m, $y) = array($date['mday'], $date['mon'], $date['year']); // This is what we want to display
     $display->maxdays = calendar_days_in_month($m, $y);
 
-    // We 'll keep these values as GMT here, and offset them when the time comes to query the db
-    $display->tstart = gmmktime(0, 0, 0, $m, 1, $y); // This is GMT
-    $display->tend = gmmktime(23, 59, 59, $m, $display->maxdays, $y); // GMT
+    if (get_user_timezone_offset() < 99) {
+        // We 'll keep these values as GMT here, and offset them when the time comes to query the db
+           $display->tstart = gmmktime(0, 0, 0, $m, 1, $y); // This is GMT
+           $display->tend = gmmktime(23, 59, 59, $m, $display->maxdays, $y); // GMT
+    } else {
+        // no timezone info specified
+           $display->tstart = mktime(0, 0, 0, $m, 1, $y);
+           $display->tend = mktime(23, 59, 59, $m, $display->maxdays, $y);
+    }
 
     $startwday = dayofweek(1, $m, $y);