• Using iCal events list to display an ics feed. Having trouble with display of events that span midnight but are less than 24 hours long – e.g.
    DTSTART;TZID=America/Chicago:20150109T170000
    DTEND;TZID=America/Chicago:20150110T163000
    This only shows on the Friday box of the large calendar view. I think it should display on the Saturday as well. I looked into this, and I believe the problem can be fixed in amr-ical-calendar.php by replacing the arm_event_is_multiday function with the following (PHP 5.3 compatible):
    // —————————————————————————————-
    function amr_event_is_multiday($event) { //determine if event is a multi day event

    if (empty($event[‘EndDate’])) return false; // no duration at all, just a date
    if (!(is_object($event[‘EventDate’]) and (is_object($event[‘EndDate’])))) return(false);

    $eventDate = clone $event[‘EventDate’];
    $endDate = clone $event[‘EndDate’];
    // calculate the number of midnights between the start and end of the event
    $eventDate->setTime(0,0,0);
    $endDate->setTime(0,0,0);
    $dti = $eventDate->diff($endDate); // DateInterval
    $days = ($dti->days * ( $dti->invert ? -1 : 1)) +1;

    if (isset($_GET[‘debugmulti’])) echo ‘
    The number of days over which to show event ‘.$event[‘SUMMARY’].’ is = ‘.$days;

    return $days;
    }

    However, counting the number of midnights exposed what I believe is an incorrect calculation of the ‘allday’ flag in amr_is_all_day(). I think an additional check is needed such that an event is only considered allday if it starts and ends at midnight. Otherwise, with an event exactly 24 hours long – e.g.
    DTSTART;TZID=America/Chicago:20150116T150000
    DTEND;TZID=America/Chicago:20150117T150000
    the plugin modifies the EndDate to be 2015-01-16 and prevents correct display of the 2-day event. The modified amr_is_all_day function is as below:

    function amr_is_all_day($d1, $d2) {
    if (!(is_object($d1) and (is_object($d2)))) return(false);

    if ($d1==$d2) return false; // if exact match then assume strict RC 5545 adherence, so cannot be all day, must be zero duration

    // all day events must begin and end at midnight
    $d1m = clone $d1;
    $d2m = clone $d2;
    if( $d1 != $d1m->setTime( 0,0,0) or $d2 != $d2m->setTime(0,0,0)) return false;

    $dur = amr_calc_duration ( $d1, $d2); // duration could be zero if no end time or DTEND exact same as DTSTART (not all day)
    if (empty ($dur[‘hours’]) and empty ($dur[‘minutes’]) and empty ($dur[‘seconds’] )) {
    return true;
    }
    else {
    return (false);
    }
    }

    https://wordpress.org/plugins/amr-ical-events-list/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘largecalendar Display of events spanning more than one day’ is closed to new replies.