Index: /trunk/expressoCalendar/setup/tables_current.inc.php
===================================================================
--- /trunk/expressoCalendar/setup/tables_current.inc.php	(revision 5741)
+++ /trunk/expressoCalendar/setup/tables_current.inc.php	(revision 5953)
@@ -254,5 +254,5 @@
             'fd' => array(
                 'id' => array( 'type' => 'auto', 'nullable' => False),
-                'occurrence' => array(  'type' => 'bigint','precision' => '16', 'nullable' => False),
+                'occurrence' => array(  'type' => 'bigint','precision' => '16', 'nullable' => False, 'default' => 0),
                 'exception' => array(  'type' => 'smallint','precision' => '1', 'nullable' => False),
 		'repeat_id' => array(  'type' => 'int', 'precision' => '8', 'nullable' => False)
Index: /trunk/expressoCalendar/setup/tables_update.inc.php
===================================================================
--- /trunk/expressoCalendar/setup/tables_update.inc.php	(revision 5804)
+++ /trunk/expressoCalendar/setup/tables_update.inc.php	(revision 5953)
@@ -97,4 +97,13 @@
             return $GLOBALS['setup_info']['expressoCalendar']['currentver'];
 	};
+
+	$test[] = '1.004';
+	function expressoCalendar_upgrade1_004() {
+            $oProc = $GLOBALS['phpgw_setup']->oProc;
+            $oProc->query("ALTER TABLE calendar_repeat_occurrence  ALTER COLUMN occurrence SET DEFAULT 0");
+
+            $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.005';
+            return $GLOBALS['setup_info']['expressoCalendar']['currentver'];
+	};
         
         
Index: /trunk/expressoCalendar/setup/setup.inc.php
===================================================================
--- /trunk/expressoCalendar/setup/setup.inc.php	(revision 5944)
+++ /trunk/expressoCalendar/setup/setup.inc.php	(revision 5953)
@@ -13,5 +13,5 @@
 	$setup_info['expressoCalendar']['title']     	= 'Expresso Calendar';
 	/* Ao incrementar versão, não esquecer de declarar função do tables_update.inc.php*/
-	$setup_info['expressoCalendar']['version']   	= '1.004';
+	$setup_info['expressoCalendar']['version']   	= '1.005';
 	$setup_info['expressoCalendar']['app_order']	= 10;
 
Index: /trunk/prototype/modules/calendar/interceptors/DBMapping.php
===================================================================
--- /trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 5947)
+++ /trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 5953)
@@ -308,7 +308,20 @@
     if( $repeat['frequency'] === 'none' )
 	return( array() );
-
-    $start =  new DateTime( '@'.(int)( max( $start, $repeat['startTime']  ) / 1000 ), new DateTimeZone('UTC') );    
-
+ 
+    //Nao deve ser usando o horário da repeticao pois nela contem apenas o dias,
+    //deve se recuperar o horário do evento para um correto calculo.
+    if(max( $start, $repeat['startTime']  ) != $repeat['startTime']){
+	$time = new DateTime( '@'.(int)( $repeat['startTime'] / 1000 ), new DateTimeZone('UTC') );
+	
+	$hoursOcurrence = new DateTime( '@'.(int)( $start / 1000 ), new DateTimeZone('UTC') );
+	$hoursOcurrence = $hoursOcurrence->format('H');
+	
+	$diffTime = ((($time->format('H') - $hoursOcurrence) * (3600000)) + ($time->format('i') * (60000)));
+	$start =  new DateTime( '@'.(int)( ( $start + $diffTime )  / 1000 ), new DateTimeZone('UTC') );    
+	
+	
+    }else
+	$start =  new DateTime( '@'.(int)( max( $start, $repeat['startTime']  ) / 1000 ), new DateTimeZone('UTC') );    
+    
     foreach($repeat as $rule => $value)
     {
Index: /trunk/prototype/modules/calendar/js/calendar.codecs.js
===================================================================
--- /trunk/prototype/modules/calendar/js/calendar.codecs.js	(revision 5947)
+++ /trunk/prototype/modules/calendar/js/calendar.codecs.js	(revision 5953)
@@ -763,5 +763,5 @@
 		    var tzId =  form.timezone || Calendar.signatureOf[form.calendar].calendar.timezone || User.preferences.timezone,
 
-		    formatString = ( typeof form.allDay !== "undefined" && !!form.allDay )? pref.dateFormat+" HH:mm" : pref.dateFormat + " " + pref.hourForma;
+		    formatString = ( typeof form.allDay !== "undefined" && !!form.allDay )? pref.dateFormat+" HH:mm" : pref.dateFormat + " " + pref.hourFormat;
 
 		    var Owner = decodeOwnerCalendar(form.calendar);
