From d61989033ff1c3fafa8e23faf43a56c02c1cfb91 Mon Sep 17 00:00:00 2001 From: skodak Date: Mon, 3 Jul 2006 09:10:12 +0000 Subject: [PATCH] Bug #5991 - The calendar does not show the month's first day's event; merged from MOODLE_16_STABLE --- calendar/lib.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/calendar/lib.php b/calendar/lib.php index fe5c126537..bf077d10a6 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -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); -- 2.39.5