Hi,
When importing an Ical calendar from google to my drupal calendar module, using feed api, ical parser and feed element mapper, I noticed a strange behaviour with an event spanning multiple days and everyday is a whole day event. Only the first day was imported.
Searching the code I found lines 198 and further in date_api_ical.inc to make this adjustments. The remarks are clear. This is done to prevent programs from wrong interpretation.
However if no time is specified and the difference between start and ending lasts more than a day and there's an end date, shouldn't it just adjust the end date:
if (!empty($subgroup['DTSTART']) && (!empty($subgroup['DTSTART']['all_day']) ||
(empty($subgroup['DTEND']) && empty($subgroup['RRULE']) && empty($subgroup['RRULE']['COUNT'])))) {
// Many programs output DTEND for an all day event as the
// following day, reset this to the same day for internal use.
// ADJUSTED
$subgroup['all_day'] = TRUE;
// When difference is more than one day, and we already know its a whole day
if ((strtotime($subgroup['DTEND']['datetime'])-strtotime($subgroup['DTSTART']['datetime']) != 0)
&& (strtotime($subgroup['DTEND']['datetime'])-strtotime($subgroup['DTSTART']['datetime']) != 86400)
&& !empty($subgroup['DTEND'])
)
{
$subgroup['DTEND']['datetime'] = strftime("%Y-%m-%d",(strtotime("-1 days",strtotime($subgroup['DTEND']['datetime']))));
} else {
// do as you normally would
$subgroup['DTEND'] = $subgroup['DTSTART'];
}
}
I know it isn't the right code, but I couldn't figure out how to use the date_difference function or any other function to adjust the date, already provided by the date api.
I haven't found any program interpreting an ical feed differently. If no time is set, only a date is given, the event spans from the beginning until the end - 1 day.
Koen
Comments
Comment #1
arlinsandbulte commentedIs this issue still valid?
Comment #2
arlinsandbulte commentedno reply after a few months at status of 'postponed (maintainer needs more info)'
marking won't fix.