--- event.module  2007-12-03 16:55:43.000000000 +0000
+++ event.module	2007-12-04 10:37:47.000000000 +0000
@@ -557,8 +557,11 @@ function event_calendar_month($op, $date
   $row = array_fill(0, 6, array('class' => 'pad'));
   // get the day of week offset value for the first day of the month
   $start = $offset = _event_day_of_week($cur_date);
+  
+  $cur_date_check = (int) ($cur_date['year'].$cur_date['month'].$cur_date['day']);
+  $last_date_check = (int) ($last_date['year'].$last_date['month'].$last_date['day']);
   // render the month calendar
-  while ($last_date['day'] > $cur_date['day']) {
+  while ($last_date_check > $cur_date_check) {
    $week = 0;
     for ($x = $start; $x < 7; $x++) {
       $cur_day = (($week * 7) + ($x + 1) - $offset);
@@ -566,7 +569,10 @@ function event_calendar_month($op, $date
         'class' => strtolower($weekdays[$x]['day']) . ' day-'. $cur_date['day'] . ($cur_date == $today ? ' today' : '') . ($cur_date['day'] == $day ? ' selected' : ''),
         'data' => $callback($cur_date, $view, $types, $terms));
       $cur_date = event_date_later($cur_date, 1);
-      if ($cur_date['day'] > $last_date['day']) {
+      $cur_date_check = (int) ($cur_date['year'].$cur_date['month'].$cur_date['day']);
+      $last_date_check = (int) ($last_date['year'].$last_date['month'].$last_date['day']);
+      
+      if ($cur_date_check > $last_date_check) {
         $x = 8;
       }
     }
