Skip to content

Wrong recurrence calculation for whole day events with a user defined time zone #180

@hubermat

Description

@hubermat

[Offending iCal uploaded to this issue, will be provided as part of the unit tests in the pull request.]

  • PHP Version: 7.0.26
  • PHP date.timezone: Europe/Berlin
  • ICS Parser Version: 2.1.5
  • Mac

Description of the Issue:

The issue came up while parsing a private iCloud calendar.

Parsing a recurrent event with a date value without timezone (here: '20180701') as start value (whole day event), should be interpreted as a full day in the Europe/Berlin timezone (by setting the defaultTimeZone in the options to 'Europe/Berlin'). But it returns wrong dates and timestamps:

  • The first recurrent event should be '20180801T000000' (local time midnight), but is returned as '20180701T000000Z' (midnight UTC, and wrong month)
  • Timestamp is 1530403200 instead of expected 1533074400.

Similar for all other generated recurrences of this event.

Steps to Reproduce:

Run the parser with this code:

$options = array(
  'defaultSpan'                 => 2,     // Default value
  'defaultTimeZone'             => 'Europe/Berlin', // Default value: UTC
  'defaultWeekStart'            => 'MO',  // Default value
  'disableCharacterReplacement' => false, // Default value
  'skipRecurrence'              => false, // Default value
  'useTimeZoneWithRRules'       => false // Default value
);
$ical = new ICal('icalmonthly.txt', $options);
$events = $ical->events();

where icalmonthly.txt only contains one event with following parameters:

RRULE:FREQ=MONTHLY;BYMONTHDAY=1;WKST=SU
DTSTART;VALUE=DATE:20180701
DTEND;VALUE=DATE:20180702

The iCal file does not contain a default timezone.

Or run my unit tests to reproduce the issue also with other examples. This unit tests are part of the pull request, that I will open for this issue. The pull request contains all the setup for the unit test (composer.json, phpunit.xml etc.) as well.

icalmonthly.txt

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions