My Drupal environment is configured as such:

  • Core 7.32
  • Date iCal 7.x-3.3
  • Feeds 7.x-2.0-alpha8
  • Collecting repeating, all-day events. Dates are stored in the database as UTC.

Using the following example,

DTSTART;VALUE=DATE:20141205
DTEND;VALUE=DATE:20141206
RRULE:FREQ=WEEKLY;UNTIL=20141217;BYDAY=SU,MO,TU,WE,TH,FR,SA

the end date is reduced to the start date upon processing i.e., start="2014-12-05", end="2014-12-05".

Digging through the code, I found the offending lines in libraries/ParserVcalendar.inc:

       if (module_exists('date_all_day')) {
          // If the Date All Day module is installed, we need to rewind the
          // DTEND by one day, because of the problem with FeedsDateTime
          // mentioned below.
          $prev_day = iCalUtilityFunctions::_duration2date($property['value'], array('day' => -1));
          $property['value'] = $prev_day;
        }

If I comment out this code, the end date retains the "2014-12-06" value, as expected.

The code comments suggest that this business logic is fragile, and I am wondering what can be done to make it more robust.

For the time being, I'll leave those two lines commented out.

Comments

coredumperror’s picture

Hmmm, I'm pretty sure that single-day all-day events are supposed to be defined without a DTEND. That may be why the code you mentioned is causing problems.

A lot of what Date iCal does with all-day dates is because of fragility with the way the Date All Day module implements them (see: #874322: To Date & All Day Date Handling). I don't really think there's anything I can do to Date iCal to improve your particular situation without breaking something else.

mmikitka’s picture

If it helps, the source feed is a Google calendar, and the entry is a repeating, all-day event.

coredumperror’s picture

Have you tried setting up your feed parser to not parse the DTEND value? That might fix the problem.

coredumperror’s picture

Status: Active » Closed (works as designed)

Did you ever solve this? IF not, feel free to re-open the ticket.

mmikitka’s picture

No, I did not try removing the DTEND field since the relying application code expects the start and end date/time.

mmikitka’s picture

Status: Closed (works as designed) » Active