/**
* Render the events in an iCalendar file
*
+ * X-WR-CALNAME is supported by claws mail's vcalendar plugin; it
+ * uses it as title.
+ *
* @param array $arEvents Event objects to render
*
* @return string iCal file
{
$s = "BEGIN:VCALENDAR\n"
. "VERSION:2.0\n"
- . "PRODID:-//bdrem\n";
+ . "PRODID:-//bdrem\n"
+ . "X-WR-CALNAME:birthdays\n";
foreach ($arEvents as $event) {
$props = array('BEGIN' => 'VEVENT');
$props['UID'] = str_replace(
- array('-', '????'), array('', '0000'), $event->date
+ array('-', '????'), array('', '0000'), $event->localDate
)
. '.' . $event->age
. '.' . md5($event->title . '/' . $event->type)
. '@bdrem';
- $props['DTSTART'] = str_replace('-', '', $event->date);
+ // we want the zero time because it expresses midnight in every
+ // time zone
+ $props['DTSTART'] = str_replace('-', '', $event->localDate) . 'T000000';
$props['DURATION'] = 'P1D';
$props['SUMMARY'] = sprintf(
'%s - %s. %s', $event->title, $event->age, $event->type