Index: branches/2.4/expressoCalendar/setup/tables_current.inc.php
===================================================================
--- branches/2.4/expressoCalendar/setup/tables_current.inc.php	(revision 7383)
+++ branches/2.4/expressoCalendar/setup/tables_current.inc.php	(revision 7594)
@@ -321,5 +321,5 @@
 
 				
-	'module_preference' => array(
+	    'module_preference' => array(
             'fd' => array(
                 'id' => array( 'type' => 'auto', 'nullable' => False),
@@ -334,5 +334,32 @@
             'uc' => array()
 		),
-		
+
+        'calendar_timezones' => array(
+            'fd' => array(
+            'id' => array( 'type' => 'auto', 'nullable' => False),
+            'timezone' => array(  'type' => 'varchar','precision' => '150', 'nullable' => False),
+
+            'standard_frequency' => array(  'type' => 'varchar','precision' => '20', 'nullable' => False),
+            'standard_dtstart' => array(  'type' => 'varchar','precision' => '20', 'nullable' => True),
+            'standard_byday' => array(  'type' => 'varchar','precision' => '50', 'nullable' => True),
+            'standard_bymonth' => array(  'type' => 'varchar','precision' => '50', 'nullable' => True),
+            'standard_from' => array(  'type' => 'varchar','precision' => '10', 'nullable' => True),
+            'standard_to' => array(  'type' => 'varchar','precision' => '10', 'nullable' => True),
+
+            'daylight_frequency' => array(  'type' => 'varchar','precision' => '20', 'nullable' => False),
+            'daylight_dtstart' => array(  'type' => 'varchar','precision' => '20', 'nullable' => True),
+            'daylight_byday' => array(  'type' => 'varchar','precision' => '50', 'nullable' => True),
+            'daylight_bymonth' => array(  'type' => 'varchar','precision' => '50', 'nullable' => True),
+            'daylight_from' => array(  'type' => 'varchar','precision' => '10', 'nullable' => True),
+            'daylight_to' => array(  'type' => 'varchar','precision' => '10', 'nullable' => True),
+
+            'dtstamp' => array( 'type' => 'bigint', 'precision' => '16', 'precision' => '16', 'nullable' => False)
+        ),
+        'pk' => array('id'),
+        'fk' => array(),
+        'ix' => array(),
+        'uc' => array()
+    ),
+
 	);
 ?>
Index: branches/2.4/expressoCalendar/setup/tables_update.inc.php
===================================================================
--- branches/2.4/expressoCalendar/setup/tables_update.inc.php	(revision 7383)
+++ branches/2.4/expressoCalendar/setup/tables_update.inc.php	(revision 7594)
@@ -190,5 +190,45 @@
         $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.010'; 
         return $GLOBALS['setup_info']['expressoCalendar']['currentver']; 
-    };    
+    };
+
+    $test[] = '1.010';
+    function expressoCalendar_upgrade1_010() {
+        $oProc = $GLOBALS['phpgw_setup']->oProc;
+            $oProc->CreateTable('calendar_timezones', array(
+                'fd' => array(
+                    'id' => array( 'type' => 'auto', 'nullable' => False),
+                    'timezone' => array(  'type' => 'varchar','precision' => '150', 'nullable' => False),
+
+                    'standard_frequency' => array(  'type' => 'varchar','precision' => '20', 'nullable' => False),
+                    'standard_dtstart' => array(  'type' => 'varchar','precision' => '20', 'nullable' => True),
+                    'standard_byday' => array(  'type' => 'varchar','precision' => '50', 'nullable' => True),
+                    'standard_bymonth' => array(  'type' => 'varchar','precision' => '50', 'nullable' => True),
+                    'standard_from' => array(  'type' => 'varchar','precision' => '10', 'nullable' => True),
+                    'standard_to' => array(  'type' => 'varchar','precision' => '10', 'nullable' => True),
+
+                    'daylight_frequency' => array(  'type' => 'varchar','precision' => '20', 'nullable' => False),
+                    'daylight_dtstart' => array(  'type' => 'varchar','precision' => '20', 'nullable' => True),
+                    'daylight_byday' => array(  'type' => 'varchar','precision' => '50', 'nullable' => True),
+                    'daylight_bymonth' => array(  'type' => 'varchar','precision' => '50', 'nullable' => True),
+                    'daylight_from' => array(  'type' => 'varchar','precision' => '10', 'nullable' => True),
+                    'daylight_to' => array(  'type' => 'varchar','precision' => '10', 'nullable' => True),
+
+                    'dtstamp' => array( 'type' => 'bigint', 'precision' => '16', 'precision' => '16', 'nullable' => False)
+                ),
+                'pk' => array('id'),
+                'fk' => array(),
+                'ix' => array(),
+                'uc' => array()
+            )
+        );
+
+        $oProc->query("INSERT INTO calendar_timezones(timezone, standard_frequency, standard_dtstart, standard_byday,
+        standard_bymonth, standard_from, standard_to, daylight_frequency, daylight_dtstart, daylight_byday,
+        daylight_bymonth, daylight_from, daylight_to, dtstamp) VALUES ('America/Sao_Paulo', 'YEARLY', '23:59',
+        '4SA', '2', '-0200','-0300', 'YEARLY', '23:59', '3SA', '10', '-0300','-0200', '". time() ."');");
+
+        $GLOBALS['setup_info']['expressoCalendar']['currentver'] = '1.011';
+        return $GLOBALS['setup_info']['expressoCalendar']['currentver'];
+    }; 
 
 ?>
Index: branches/2.4/expressoCalendar/setup/setup.inc.php
===================================================================
--- branches/2.4/expressoCalendar/setup/setup.inc.php	(revision 7228)
+++ branches/2.4/expressoCalendar/setup/setup.inc.php	(revision 7594)
@@ -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.009';
+	$setup_info['expressoCalendar']['version']   	= '1.011';
 	$setup_info['expressoCalendar']['app_order']	= 10;
 
Index: branches/2.4/prototype/services/iCal.php
===================================================================
--- branches/2.4/prototype/services/iCal.php	(revision 7254)
+++ branches/2.4/prototype/services/iCal.php	(revision 7594)
@@ -111,5 +111,75 @@
 					$this->createAttachment($v['attachments'], $vevent);
 
-			    $vevent->setProperty('uid', $v['uid']);  
+			    $vevent->setProperty('uid', $v['uid']);
+
+
+                $vevent->setProperty('uid', $v['uid']);
+
+                $timezoneDayligth = Controller::read(array('concept' => 'timezones'), null, array('filter' => array('=', 'tzid', $apTimezone)));
+
+                if(!empty( $timezoneDayligth ) && count( $timezoneDayligth ) > 0){
+
+                    if(array_key_exists(0, $timezoneDayligth))
+                        $timezoneDayligth = $timezoneDayligth[0];
+
+                    date_default_timezone_set('UTC');
+
+                    require_once ROOTPATH . '/plugins/when/When.php';
+
+                    $r = new When();
+
+                    $start = new DateTime('1970-01-01 '.$timezoneDayligth['standardDtstart']);
+
+                    $r = new When();
+                    $r->recur($start, $timezoneDayligth['standardFrequency'])
+                        ->until($start->modify('+1 years'))
+                        ->bymonth(array( $timezoneDayligth['standardBymonth'] ))
+                        ->byday(array(  $timezoneDayligth['daylightByday'] ));
+
+                   $date = $r->next();
+
+                    $timezone = &$ical->newComponent('vtimezone');
+                    $timezone->setProperty('tzid',$apTimezone );
+
+                    $standard  = &$timezone->newComponent( "standard" );
+                    $standard->setProperty( "tzoffsetfrom", $timezoneDayligth['standardFrom'] );
+                    $standard->setProperty( "tzoffsetto", $timezoneDayligth['standardTo'] );
+
+                    $standard->setProperty( "dtstart", $date->format(DATE_RFC822), array("VALUE" => "DATE") );
+
+                    $rrule = array(
+                                        'FREQ' => $timezoneDayligth['standardFrequency'],
+                        'BYMONTH' =>  $timezoneDayligth['standardBymonth'],
+                        'BYday' => array(preg_replace("/[^0-9]/", "", $timezoneDayligth['standardByday']),  "DAY" => preg_replace("/[^a-zA-Z\s]/", "", $timezoneDayligth['standardByday']))
+                    );
+
+                    $standard->setProperty('rrule', $rrule);
+
+                    $daylight  = &$timezone->newComponent( "daylight" );
+
+                    $daylight->setProperty( "tzoffsetfrom", $timezoneDayligth['daylightFrom'] );
+                    $daylight->setProperty( "tzoffsetto", $timezoneDayligth['daylightTo'] );
+
+
+                    $start = new DateTime('1970-01-01 '.$timezoneDayligth['daylightDtstart']);
+
+                    $r->recur($start, $timezoneDayligth['daylightFrequency'])
+                        ->until($start->modify('+1 years'))
+                        ->bymonth(array( $timezoneDayligth['daylightBymonth'] ))
+                        ->byday(array(  $timezoneDayligth['daylightByday'] ));
+
+                    $date = $r->next();
+
+                    $daylight->setProperty( "dtstart", $date->format(DATE_RFC822), array("VALUE" => "DATE") );
+
+                    $rrule = array(
+                        'FREQ' => $timezoneDayligth['daylightFrequency'],
+                        'BYMONTH' =>  $timezoneDayligth['daylightBymonth'],
+                        'BYday' => array(preg_replace("/[^0-9]/", "", $timezoneDayligth['daylightByday']),  "DAY" => preg_replace("/[^a-zA-Z\s]/", "", $timezoneDayligth['daylightByday']))
+                    );
+
+                    $daylight->setProperty('rrule', $rrule);
+                }
+
 			    break;
             case TODO_ID:
Index: branches/2.4/prototype/timezones.php
===================================================================
--- branches/2.4/prototype/timezones.php	(revision 7228)
+++ branches/2.4/prototype/timezones.php	(revision 7594)
@@ -12,5 +12,5 @@
 
 $localtime = localtime(time(), true);
-$timezone['isDaylightSaving'] =  !!$localtime['tm_isdst'];
+$timezone['isDaylightSaving'] =  !!$localtime['tm_isdst'] ? 1 : 0;
 
 echo json_encode($timezone);
Index: branches/2.4/prototype/config/timezones.ini
===================================================================
--- branches/2.4/prototype/config/timezones.ini	(revision 7594)
+++ branches/2.4/prototype/config/timezones.ini	(revision 7594)
@@ -0,0 +1,22 @@
+service = PostgreSQL
+PostgreSQL.concept = calendar_timezones
+
+[PostgreSQL.mapping]
+id = id
+tzid = timezone
+
+standardBymonth = standard_bymonth
+standardByday = standard_byday
+standardFrequency = standard_frequency
+standardDtstart = standard_dtstart
+standardFrom = standard_from
+standardTo = standard_to
+
+daylightBymonth = daylight_bymonth
+daylightByday = daylight_byday
+daylightFrequency = daylight_frequency
+daylightDtstart = daylight_dtstart
+daylightFrom = daylight_from
+daylightTo = daylight_to
+
+dtstamp = dtstamp
Index: branches/2.4/prototype/modules/calendar/interceptors/DBMapping.php
===================================================================
--- branches/2.4/prototype/modules/calendar/interceptors/DBMapping.php	(revision 7556)
+++ branches/2.4/prototype/modules/calendar/interceptors/DBMapping.php	(revision 7594)
@@ -822,74 +822,69 @@
     //TODO: Remover apos suporte a deepness na api 
     public function deepnessFindEvent(&$uri, &$result, &$criteria, $original) {
-	if (isset($original['criteria']['deepness']) && $original['criteria']['deepness'] != 0) {
-	    $Time = new DateTime('now', new DateTimeZone('UTC'));
-	    $DayLigth = array();
-	    foreach ($result as $i => $v) {
-
-		if ( isset($v['calendar']) && (!isset($currentTimezone) || $currentTimezone != $original['criteria']['timezones'][$v['calendar']]))  {
-		    $currentTimezone = isset($original['criteria']['timezones'][$v['calendar']]) ? $original['criteria']['timezones'][$v['calendar']] : $v['timezone'];
-		    $Time->setTimezone(new DateTimeZone($currentTimezone));
-		}
-
-		$Time->setTimestamp((int) ($v['startTime'] / 1000));
-		$DayLigth['calendar']['startTime'] = $Time->format('I') ? 1 : 0;
-
-		$Time->setTimestamp((int) ($v['endTime'] / 1000));
-		$DayLigth['calendar']['endTime'] = $Time->format('I') ? 1 : 0;
-
-		if (!isset($currentTimezone) || ($currentTimezone != $v['timezone'])) {
-		    $currentTimezone = $v['timezone'];
-		    $Time->setTimezone(new DateTimeZone($v['timezone']));
-
-		    $Time->setTimestamp((int) ($v['startTime'] / 1000));
-		    $DayLigth['event']['startTime'] = $Time->format('I') ? 1 : 0;
-
-		    $Time->setTimestamp((int) ($v['endTime'] / 1000));
-		    $DayLigth['event']['endTime'] = $Time->format('I') ? 1 : 0;
-		}else
-		    $DayLigth['event'] = $DayLigth['calendar'];
-
-
-		$result[$i]['DayLigth'] = $DayLigth;
-
-        if(((int)$v['type']) == 2){
-
-            $taskToActivity = Controller::find(array('concept' => 'taskToActivity'), false, array('filter' => array('AND', array('=', 'activity', $v['id']), array('=','owner', Config::me('uidNumber'))) , 'deepness' => 2));
-
-            if($taskToActivity)
-                $result[$i]['taskToActivity'] = $taskToActivity;
-
-            $result[$i]['historic'] = Controller::find(array('concept' => 'calendarHistoric'), false, array('filter' => array('=', 'schedulable', $v['id']) , 'deepness' => 2));
-
-        }
-
-		if (isset($v['id'])) {
-		    $data = self::decodeParticipantsEvent($uri, $v, $criteria, $original);
-
-		    $result[$i]['statusAttendees'] = isset($data['statusAttendees']) ? $data['statusAttendees'] : false;
-		    $result[$i]['sizeAttendees'] = isset($data['sizeAttendees']) ? $data['sizeAttendees'] : false;
-		    $result[$i]['participants'] = $data['attendees'];
-
-		    $attachmentRelation = Controller::find(array('concept' => 'schedulableToAttachment'), false, array('filter' => array('=', 'schedulable', $v['id'])));
-		    if (is_array($attachmentRelation)) {
-			$attachments = array();
-			foreach ($attachmentRelation as $key => $value)
-			    if (isset($value['attachment']) || !!$value['attachment'])
-				$attachments[$key] = $value['attachment'];
-			//Pega os anexos sem source
-			$result[$i]['attachments'] = Controller::find(array('concept' => 'attachment'), array('id', 'name', 'type', 'size'), array('filter' => array('IN', 'id', $attachments)));
-		    }
-
-		    $repeat = Controller::find(array('concept' => 'repeat'), false, array('filter' => array('=', 'schedulable', $v['id'])));
-
-		    unset($result[$i]['repeat']);
-
-		    if (is_array($repeat))
-			$result[$i]['repeat'] = $repeat[0];
-		}
+        if (isset($original['criteria']['deepness']) && $original['criteria']['deepness'] != 0) {
+
+            $date = new DateTime('now', new DateTimeZone('UTC'));
+            $DayLigth = array();
+
+            foreach ($result as $i => $v) {
+
+                $currentTimezone = isset($original['criteria']['timezones'][$v['calendar']]) ? $original['criteria']['timezones'][$v['calendar']] : $v['timezone'];
+
+                $date->setTimestamp((int) ($v['startTime'] / 1000));
+                $date->setTimezone( new DateTimeZone( $v['timezone'] ));
+                $DayLigth['event']['startTime'] = ($date->getTimestamp() + $date->getOffset()).'000';
+
+                $date->setTimezone( new DateTimeZone($currentTimezone));
+                $DayLigth['calendar']['startTime'] = ($date->getTimestamp() + $date->getOffset()).'000';
+
+                $date->setTimestamp((int) ($v['endTime'] / 1000));
+                $date->setTimezone( new DateTimeZone($currentTimezone));
+                $DayLigth['event']['endTime'] = ($date->getTimestamp() + $date->getOffset()).'000';
+
+                $date->setTimezone( new DateTimeZone($currentTimezone));
+                $DayLigth['calendar']['endTime'] = ($date->getTimestamp() + $date->getOffset()).'000';
+
+
+                $result[$i]['DayLigth'] = $DayLigth;
+
+                if(((int)$v['type']) == 2){
+
+                    $taskToActivity = Controller::find(array('concept' => 'taskToActivity'), false, array('filter' => array('AND', array('=', 'activity', $v['id']), array('=','owner', Config::me('uidNumber'))) , 'deepness' => 2));
+
+                    if($taskToActivity)
+                        $result[$i]['taskToActivity'] = $taskToActivity;
+
+                    $result[$i]['historic'] = Controller::find(array('concept' => 'calendarHistoric'), false, array('filter' => array('=', 'schedulable', $v['id']) , 'deepness' => 2));
+
+                }
+
+                if (isset($v['id'])) {
+                    $data = self::decodeParticipantsEvent($uri, $v, $criteria, $original);
+
+                    $result[$i]['statusAttendees'] = isset($data['statusAttendees']) ? $data['statusAttendees'] : false;
+                    $result[$i]['sizeAttendees'] = isset($data['sizeAttendees']) ? $data['sizeAttendees'] : false;
+                    $result[$i]['participants'] = $data['attendees'];
+
+                    $attachmentRelation = Controller::find(array('concept' => 'schedulableToAttachment'), false, array('filter' => array('=', 'schedulable', $v['id'])));
+                    if (is_array($attachmentRelation)) {
+                    $attachments = array();
+                    foreach ($attachmentRelation as $key => $value)
+                        if (isset($value['attachment']) || !!$value['attachment'])
+                        $attachments[$key] = $value['attachment'];
+                    //Pega os anexos sem source
+                    $result[$i]['attachments'] = Controller::find(array('concept' => 'attachment'), array('id', 'name', 'type', 'size'), array('filter' => array('IN', 'id', $attachments)));
+                    }
+
+                    $repeat = Controller::find(array('concept' => 'repeat'), false, array('filter' => array('=', 'schedulable', $v['id'])));
+
+                    unset($result[$i]['repeat']);
+
+                    if (is_array($repeat))
+                    $result[$i]['repeat'] = $repeat[0];
+                }
+            }
 	    }
-	}
-
-	return $result;
+
+	    return $result;
     }
     
Index: branches/2.4/prototype/modules/calendar/js/calendar.codecs.js
===================================================================
--- branches/2.4/prototype/modules/calendar/js/calendar.codecs.js	(revision 7402)
+++ branches/2.4/prototype/modules/calendar/js/calendar.codecs.js	(revision 7594)
@@ -604,8 +604,8 @@
 		timezone: objEvent.timezone,
 		timezones: Timezone.timezones,
-		startDate: new Date( parseInt(objEvent.startTime) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ),
-		startHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(objEvent.startTime)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'startTime'), User.preferences.hourFormat),
-		endDate: new Date( parseInt(objEvent.endTime) - (!!parseInt(objEvent.allDay) ? 86400000 : 0)  ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ),
-		endHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date(parseInt(objEvent.endTime)),  objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'endTime'), User.preferences.hourFormat),
+        startDate: Timezone.getDate( (objEvent.DayLigth ? objEvent.DayLigth.event.startTime : objEvent.startTime), 'start', objEvent.allDay ),
+        startHour: objEvent.DayLigth ? Timezone.getHour( objEvent.DayLigth.event.startTime) : Timezone.formateHour( objEvent.startTime ),
+        endDate: Timezone.getDate( (objEvent.DayLigth ? objEvent.DayLigth.event.endTime : objEvent.endTime), 'end', objEvent.allDay ),
+        endHour: objEvent.DayLigth ? Timezone.getHour( objEvent.DayLigth.event.endTime) : Timezone.formateHour( objEvent.endTime ),
 		allDay: !!parseInt( objEvent.allDay ),
 		dueDate: objEvent.dueDate,
@@ -1405,5 +1405,5 @@
 			    isExternal: !!parseInt(form.attendeeType[i]) ? 1 : 0,
 			    acl: form.attendee_organizer == attendee ? (form.attendeeAcl[i].indexOf('o') < 0 ? form.attendeeAcl[i]+'o' : form.attendeeAcl[i]) : form.attendeeAcl[i].replace('o', '')
-			}, form.delegatedFrom[i] != '0' ? {
+			}, (form.delegatedFrom[i] != '0' && form.delegatedFrom[i] != '') ? {
 			    delegatedFrom: form.delegatedFrom[i]
 			    } : {});
@@ -1746,7 +1746,7 @@
 	    }
 
-		var duration = parseInt( evt.endTime ) - parseInt( evt.startTime ), isRepeat = false;
-
-		var occurrences = [];
+		var duration =parseInt( evt.DayLigth.calendar.endTime ) - parseInt( evt.DayLigth.calendar.startTime ), isRepeat = false;
+
+        var occurrences = [];
 		
 		if( evt.occurrences )
@@ -1755,7 +1755,7 @@
 			occurrences = evt.occurrences;
 	    }else
-			occurrences[ occurrences.length ] = evt.startTime;
-
-	    //occurrences = DataLayer.unique( occurrences ).sort();
+			occurrences[ occurrences.length ] = evt.DayLigth.calendar.startTime;
+
+        //occurrences = DataLayer.unique( occurrences ).sort();
 		var typeEvent;  
 	    for( var i = 0; i < occurrences.length; i++ )
@@ -1766,7 +1766,7 @@
 				id: evt.URI || evt.id+ '-' + i,
 				title: Encoder.htmlDecode(evt.summary),
-				start: Timezone.getDateCalendar(new Date( parseInt( occurrences[i] ) ), calendar.timezone,  !!evt.DayLigth ? evt.DayLigth.calendar.startTime : Timezone.daylightSaving),
-				end:   Timezone.getDateCalendar(new Date( parseInt( occurrences[i] ) + duration - (!!parseInt(evt.allDay) ? 86400000 : 0)), calendar.timezone, !!evt.DayLigth ? evt.DayLigth.calendar.startTime : Timezone.daylightSaving),
-				allDay: parseInt( evt.allDay ),
+				start: Timezone.getDateObjCalendar( occurrences[i], 'start', evt.allDay),
+                end:   Timezone.getDateObjCalendar( (parseInt( occurrences[i] ) + duration), 'end', evt.allDay),
+                allDay: parseInt( evt.allDay ),
 				isRepeat: isRepeat,
 				occurrence: i,
Index: branches/2.4/prototype/modules/calendar/js/timezone.js
===================================================================
--- branches/2.4/prototype/modules/calendar/js/timezone.js	(revision 6069)
+++ branches/2.4/prototype/modules/calendar/js/timezone.js	(revision 7594)
@@ -11,5 +11,5 @@
 	daylightSaving: isNaN(parseInt( objTime.isDaylightSaving )) ? 0 : parseInt( objTime.isDaylightSaving ),
 
-	timezones: objTime.timezones,	  
+    timezones: objTime.timezones,
 	timezone: function( tzId ){
 
@@ -18,34 +18,37 @@
 	},
 	
-	getDateCalendar: function(date, tzId, isDay){
-		var timezone = this.timezone( tzId );
-
-		if(!timezone)
-			return date;
-
-	 	date = this.normalizeDate(date, false, true);
-
-		return date.add({hours: parseInt(timezone.charAt(0) + timezone.charAt(2))  +  parseInt(isDay) });
+	getDateCalendar: function(date, tzId, isDayLigth ){
+		return date;
 	},
 	
-	getDateEvent: function(date, tzId, idCalendar, isDay, type){
-		var timezone = this.timezone( tzId );
-		var timezoneCurrent = this.timezone(DataLayer.get('calendar', idCalendar).timezone);
+	getDateEvent: function(date, tzId, isDayLigth){
+        if(!tzId)
+            return date;
 
-		if(timezone == timezoneCurrent)
-			return date;
-		
-		var to = parseInt(timezone.charAt(0) + timezone.charAt(2)) + parseInt(isDay.event[type]);
-		var current = parseInt(timezoneCurrent.charAt(0) + timezoneCurrent.charAt(2)) + parseInt(isDay.calendar[type]);
-		
-		if(timezone.charAt(0) == timezoneCurrent.charAt(0))
-			hours =   (  to + (current * - 1)) ;
-		else
-			hours =  to + (( current ) * (timezone.charAt(0) ==  '+'  ? -1 : 1)) ;
-		
-		return date.add({hours: hours});
-	},
-	
-	normalizeDate: function(date, current, inverse){
+        var timezone = this.timezone( tzId );
+
+        if(!timezone)
+            return date;
+
+        date = this.normalizeDate(date, false, true);
+
+        return date.add({hours: (parseInt(timezone.charAt(0) + timezone.charAt(2)) + Timezone.diff( isDayLigth )) });
+
+    },
+
+    diff: function(isDayLigth){
+
+        if( !parseInt( isDayLigth ) ){
+
+            return 0;
+
+        }else{
+
+            return (parseInt( isDayLigth ) == 1 ? 1 : -1);
+        }
+
+    },
+
+    normalizeDate: function(date, current, inverse){
 		var offsetDate = !!current ? this.currentOffset : date.getUTCOffset();
 		return date.add({hours: (parseInt(offsetDate.charAt(0) + offsetDate.charAt(2)) * (!!inverse ? -1 : 1) )});
@@ -54,4 +57,34 @@
 	getDateMapDisponibility: function(date){
 		return this.normalizeDate(date, false, true);
-	}
+	},
+
+    getHour: function(time){
+
+        return dateCalendar.formatDate( Timezone.normalizeDate( new Date( parseInt( time ) ), false, true) , User.preferences.hourFormat);
+
+    },
+
+    formateHour: function(time){
+
+        return dateCalendar.formatDate(  new Date( parseInt( time ) ) , User.preferences.hourFormat);
+
+    },
+
+    getDate: function( time, rang, isAllDay){
+
+        return (new Date( parseInt( time ) - ((rang == 'end' && isAllDay && parseInt(isAllDay) == 1) ? 86400000 : 0) )).toString( User.preferences.dateFormat );
+
+    },
+
+    getDateObj: function( time, rang, isAllDay){
+
+        return Timezone.normalizeDate(new Date( parseInt( time ) - ((rang == 'end' && isAllDay && parseInt(isAllDay) == 1) ? 86400000 : 0) ), false, true);
+
+    },
+
+    getDateObjCalendar: function( time, rang, isAllDay){
+
+        return  Timezone.normalizeDate(new Date( parseInt( time ) - ((rang == 'end' && isAllDay && parseInt(isAllDay) == 1) ? 86400000 : 0)), false, true);
+
+    }
 }
