Only in calendar: .git
Only in calendar: MyProject.kpf
diff -r -up calendar-6.x.2.2/includes/calendar.inc calendar/includes/calendar.inc
--- calendar-6.x.2.2/includes/calendar.inc	2009-05-11 15:24:27.000000000 -0700
+++ calendar/includes/calendar.inc	2010-11-24 17:04:04.000000000 -0700
@@ -391,12 +391,17 @@ function calendar_build_nodes(&$view, &$
         // For now, use the date fields's timezone for the day splitting.
         $display_timezone_name = $to_zone;
         $values_display = array();
-        
+
+        // check to see if the end of the day is to be altered in anyway
+        $day_end = $view->date_info->calendar_day_end;
+                
         // Start date
         $date = date_make_date($values[0], $db_tz, $field['sql_type']);
         if ($db_tz != $to_zone) {
           date_timezone_set($date, timezone_open($to_zone));
         }
+        if($day_end)
+          date_modify($date, "-{$day_end} hours");
         $values[0] = date_format($date, DATE_FORMAT_DATETIME);
             
         if ($display_timezone_name != $to_zone) {
@@ -412,6 +417,8 @@ function calendar_build_nodes(&$view, &$
         if ($db_tz != $to_zone) {
           date_timezone_set($date, timezone_open($to_zone));
         }
+        if($day_end)
+          date_modify($date, "-{$day_end} hours");
         $values[1] = date_format($date, DATE_FORMAT_DATETIME);
         if ($display_timezone_name != $to_zone) {
           date_timezone_set($date, $display_timezone);
diff -r -up calendar-6.x.2.2/includes/calendar.views_default.inc calendar/includes/calendar.views_default.inc
--- calendar-6.x.2.2/includes/calendar.views_default.inc	2009-02-21 09:33:15.000000000 -0700
+++ calendar/includes/calendar.views_default.inc	2010-11-24 17:04:04.000000000 -0700
@@ -334,6 +334,7 @@ $handler->override_option('calendar_colo
 $handler->override_option('calendar_colors_taxonomy', array());
 $handler->override_option('calendar_popup', 0);
 $handler->override_option('calendar_date_link', $date_link_type);
+$handler->override_option('calendar_day_end', 0);
 // Calendar block.
 $handler = $view->new_display('calendar_block', 'Calendar block', 'calendar_block_1');
 $handler->override_option('style_options', array());
diff -r -up calendar-6.x.2.2/includes/calendar_plugin_display_attachment.inc calendar/includes/calendar_plugin_display_attachment.inc
--- calendar-6.x.2.2/includes/calendar_plugin_display_attachment.inc	2009-03-17 11:03:36.000000000 -0700
+++ calendar/includes/calendar_plugin_display_attachment.inc	2010-11-24 17:04:04.000000000 -0700
@@ -134,6 +134,7 @@ class calendar_plugin_display_attachment
       $this->view->date_info->calendar_colors = $this->view->display[$display_id]->handler->options['calendar_colors'];
       $this->view->date_info->calendar_colors_taxonomy = $this->view->display[$display_id]->handler->options['calendar_colors_taxonomy'];
       $this->view->date_info->calendar_popup = $this->view->display[$display_id]->handler->options['calendar_popup'];
+      $this->view->date_info->calendar_day_end = $this->view->display[$display_id]->handler->options['calendar_day_end'];
       $this->view->date_info->calendar_date_link = $this->view->display[$display_id]->handler->options['calendar_date_link'];
     }  
     parent::attach_to($display_id);
diff -r -up calendar-6.x.2.2/includes/calendar_plugin_display_page.inc calendar/includes/calendar_plugin_display_page.inc
--- calendar-6.x.2.2/includes/calendar_plugin_display_page.inc	2009-07-24 12:44:09.000000000 -0700
+++ calendar/includes/calendar_plugin_display_page.inc	2010-11-24 17:04:04.000000000 -0700
@@ -61,6 +61,7 @@ class calendar_plugin_display_page exten
     $options['calendar_colors_vocabulary'] = array('default' => array());
     $options['calendar_colors_taxonomy'] = array('default' => array());
     $options['calendar_popup'] = array('default' => 0);
+    $options['calendar_day_end'] = array('default' => 0);
     $options['calendar_date_link'] = array('default' => '');
     $options['style_plugin'] = array('default' => 'calendar_nav');
     return $options;
@@ -110,11 +111,26 @@ class calendar_plugin_display_page exten
       'value' => !empty($default) ? check_plain(node_get_types('name', $default)) : '',
     );
 
+    $day_end_options = $this->day_end_options();
+    $default = $this->get_option('calendar_day_end');
+    $options['calendar_day_end'] = array(
+      'category' => 'calendar_settings',
+      'title' => t('Day End'),
+      'value' => isset($default) ? $day_end_options[$default] : $day_end_options[0],
+    );
   }
   
   function popup_options() {
     return array(0 => t('No'), 1 => t('Yes'));
   }
+  
+  function day_end_options() {
+    $return_array = array();
+    for($i = 0; $i < 24; $i++) {
+      $return_array[$i] = $i ? $i.":00" : 'midnight';
+    }
+    return $return_array;
+  }
    
   function options_form(&$form, &$form_state) {
     // It is very important to call the parent function here:
@@ -219,6 +235,17 @@ class calendar_plugin_display_page exten
 	      }
 	      $form['calendar_colors_taxonomy']['color']['#suffix'] = '</div>';
         break;
+        
+      case 'calendar_day_end':
+        $day_end_options = $this->day_end_options();
+        $form['#title'] .= t('Day End');
+        $form['calendar_day_end'] = array(
+          '#type' => 'select',
+          '#default_value' => $this->get_option('calendar_day_end'),
+          '#options' => $day_end_options,
+          '#description' => t('Days typically end at midnight (by default).  Extend the time a typical day ends by choosing the appropriate time.  Be aware that any event starting before this time will appear on the previous day.'),
+          );  
+        break;
     }
   }
 
@@ -244,6 +271,9 @@ class calendar_plugin_display_page exten
         $this->set_option($form_state['section'], ($form_state['values'][$form_state['section']]));
         variable_set('calendar_date_link_'. $form_state['values']['calendar_date_link'], $this->display->handler->get_option('path'));
         break;
+      case 'calendar_day_end':
+        $this->set_option($form_state['section'], $form_state['values'][$form_state['section']]);
+        break;
     }
   }  
 
diff -r -up calendar-6.x.2.2/theme/theme.inc calendar/theme/theme.inc
--- calendar-6.x.2.2/theme/theme.inc	2009-07-02 07:42:08.000000000 -0700
+++ calendar/theme/theme.inc	2010-11-24 17:04:04.000000000 -0700
@@ -330,6 +330,14 @@ function template_preprocess_calendar_da
       else {
         $column = t('Items');
       }
+
+      //If using day end, undo the timing for display purposes
+      if($view->date_info->calendar_day_end) {
+        $date_new = date_create($time);
+        date_modify($date_new, "+{$view->date_info->calendar_day_end} hours");
+        $time = date_format($date_new, "h:m:i");
+      }
+
       // Find the next time slot and fill it. Populate the skipped
       // slots if the option to show empty times was chosen.
       while ($time >= $next_start_time && $time < $end_start_time) {
@@ -446,6 +454,14 @@ function template_preprocess_calendar_we
       foreach ($items as $item) {
         // Find the next time slot and fill it. Populate the skipped
         // slots if the option to show empty times was chosen.
+
+        //If using day end, undo the timing for display purposes
+        if($view->date_info->calendar_day_end) {
+          $date_new = date_create($time);
+          date_modify($date_new, "+{$view->date_info->calendar_day_end} hours");
+          $time = date_format($date_new, "h:m:i");
+        }
+
         while ($time >= $next_start_time && $time < $end_start_time) {
           if (($show_empty_times) && !array_key_exists($start_time, $grouped_items)) {
             $grouped_items[$start_time]['values'][$weekno] = array();   
