civicrm_email.email as email,
civicrm_event.title as title,
civicrm_event.summary as summary,
+ civicrm_event.event_tz as event_tz,
civicrm_event.start_date as start,
civicrm_event.end_date as end,
civicrm_event.description as description,
$info['event_id'] = $dao->event_id;
$info['summary'] = $dao->summary;
$info['description'] = $dao->description;
+ $info['tz'] = $dao->event_tz ?? CRM_Core_Config::singleton()->userSystem->getTimeZoneString();
$info['start_date'] = $dao->start;
$info['end_date'] = $dao->end;
$info['contact_email'] = $dao->email;
$config = CRM_Core_Config::singleton();
$info = CRM_Event_BAO_Event::getCompleteInfo($start, $type, $id, $end);
+
+ foreach ($info as &$event) {
+ $event['start_date'] = CRM_Utils_Date::convertTimeZone($event['start_date'], $event['tz']);
+ $event['end_date'] = !empty($event['end_date']) ? CRM_Utils_date::convertTimeZone($event['end_date'], $event['tz']) : NULL;
+ $event['registration_start_date'] = !empty($event['registration_start_date']) ? CRM_Utils_date::convertTimeZone($event['registration_start_date'], $event['tz']) : NULL;
+ $event['registration_end_date'] = !empty($event['registration_end_date']) ? CRM_Utils_date::convertTimeZone($event['registration_end_date'], $event['tz']) : NULL;
+ }
+
$template->assign('events', $info);
- $template->assign('timezone', @date_default_timezone_get());
+ $template->assign('timezone', CRM_Core_Config::singleton()->userSystem->getTimeZoneString());
// Send data to the correct template for formatting (iCal vs. gData)
if ($rss) {
$end = CRM_Utils_Request::retrieveValue('end', 'Positive', 0);
$info = CRM_Event_BAO_Event::getCompleteInfo($start, $type, $id, $end);
+
+ foreach ($info as &$event) {
+ $event['start_date_utc'] = CRM_Utils_Date::convertTimeZone($event['start_date'], 'UTC');
+ $event['start_date'] = CRM_Utils_Date::convertTimeZone($event['start_date'], $event['tz']);
+
+ $event['end_date_utc'] = !empty($event['end_date']) ? CRM_Utils_Date::convertTimeZone($event['end_date'], 'UTC') : NULL;
+ $event['end_date'] = !empty($event['end_date']) ? CRM_Utils_date::convertTimeZone($event['end_date'], $event['tz']) : NULL;
+
+ $event['registration_start_date_utc'] = !empty($event['registration_start_date']) ? CRM_Utils_Date::convertTimeZone($event['registration_start_date'], 'UTC') : NULL;
+ $event['registration_start_date'] = !empty($event['registration_start_date']) ? CRM_Utils_date::convertTimeZone($event['registration_start_date'], $event['tz']) : NULL;
+
+ $event['registration_end_date_utc'] = !empty($event['registration_end_date']) ? CRM_Utils_Date::convertTimeZone($event['registration_end_date'], 'UTC') : NULL;
+ $event['registration_end_date'] = !empty($event['registration_end_date']) ? CRM_Utils_date::convertTimeZone($event['registration_end_date'], $event['tz']) : NULL;
+ }
+
$this->assign('events', $info);
// @todo Move this to eventcart extension
{/if}
CALSCALE:GREGORIAN
{if $event.start_date}
-DTSTAMP;TZID={$timezone}:{$event.start_date|crmICalDate}
-DTSTART;TZID={$timezone}:{$event.start_date|crmICalDate}
+DTSTAMP;TZID={$event.tz|default:$timezone}:{$event.start_date|crmICalDate}
+DTSTART;TZID={$event.tz|default:$timezone}:{$event.start_date|crmICalDate}
{else}
DTSTAMP;TZID={$timezone}:{$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'|crmICalDate}
{/if}
{if $event.end_date}
-DTEND;TZID={$timezone}:{$event.end_date|crmICalDate}
+DTEND;TZID={$event.tz|default:$timezone}:{$event.end_date|crmICalDate}
{else}
-DTEND;TZID={$timezone}:{$event.start_date|crmICalDate}
+DTEND;TZID={$event.tz|default:$timezone}:{$event.start_date|crmICalDate}
{/if}
{if $event.is_show_location EQ 1 && $event.location}
LOCATION:{$event.location|crmICalText}
<td><a href="{crmURL p='civicrm/event/info' q="reset=1&id=`$event.event_id`"}" title="{ts}read more{/ts}"><strong>{$event.title}</strong></a></td>
<td>{if $event.summary}{$event.summary|purify} (<a href="{crmURL p='civicrm/event/info' q="reset=1&id=`$event.event_id`"}" title="{ts}details...{/ts}">{ts}read more{/ts}...</a>){else} {/if}</td>
<td class="nowrap" data-order="{$event.start_date|crmDate:'%Y-%m-%d'}">
- {if $event.start_date}{$event.start_date|crmDate}{if $event.end_date}<br /><em>{ts}through{/ts}</em><br />{strip}
+ {if $event.start_date}<time datetime="{$event.start_date_utc|date_format:"%Y-%m-%dT%H:%M:%S"}Z">{$event.start_date|crmDate}{if !$event.end_date}<span class="timezone"> {$event.tz}</span>{/if}</time>{if $event.end_date}<br /><em>{ts}through{/ts}</em><br /><time datetime="{$event.end_date_utc|date_format:"%Y-%m-%dT%H:%M:%S"}Z">{strip}
{* Only show end time if end date = start date *}
{if $event.end_date|date_format:"%Y%m%d" == $event.start_date|date_format:"%Y%m%d"}
- {$event.end_date|crmDate:0:1}
+ {$event.end_date|crmDate:0:1}
{else}
- {$event.end_date|crmDate}
- {/if}{/strip}{/if}
+ {$event.end_date|crmDate}
+ {/if}
+ {/strip}<span class="timezone"> {$event.tz}</span></time>
+{/if}
{else}{ts}(not available){/ts}{/if}
</td>
<td>{if $event.is_show_location EQ 1 AND $event.location}{$event.location}{else}{ts}(not available){/ts}{/if}</td>