Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-49197

iCalendar all-day events without TZ are not imported correctly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.7.5, 2.8.3
    • Fix Version/s: None
    • Component/s: Calendar
    • Labels:
    • Testing Instructions:
      Hide

      Manual steps:

      1. Ensure the local (default) timezone is different from UTC.
      2. Go to Calendar, click Manage Subscriptions.
      3. Import events from lib/tests/fixtures/zimbra_allday.ics.
      4. On the calendar, ensure that "Test all-day event" is created on February 12 2015.
        The event should start at midnight. Before applying the patch, the start time is in the wrong timezone.

      PHPunit testing:
      vendor/bin/phpunit --filter core_calendar_ical_testcase::test_calendar_add_subscription

      Show
      Manual steps: Ensure the local (default) timezone is different from UTC. Go to Calendar, click Manage Subscriptions. Import events from lib/tests/fixtures/zimbra_allday.ics. On the calendar, ensure that "Test all-day event" is created on February 12 2015. The event should start at midnight. Before applying the patch, the start time is in the wrong timezone. PHPunit testing: vendor/bin/phpunit --filter core_calendar_ical_testcase::test_calendar_add_subscription
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-49197-floating-timezone

      Description

      Hi,

      (I looked through the open Calendar issues and didn't see one that I thought matched this. Apologies if I missed one and this is a duplicate...)

      Zimbra's iCal exporter creates all-day events with DTSTART and DTEND like this:

      DTSTART;VALUE=DATE:20150212
      DTEND;VALUE=DATE:20150213

      There is no X-WR-TIMEZONE in the file, so Moodle assumes UTC and interprets these values as midnight UTC, while we are in America/Vancouver (UTC-8). So our all-day events, when imported into Moodle, are showing up as lasting from 4pm to 4pm!

      An easy fix for this specific case would be for calendar_add_icalendar_event to use local time as the default timezone, rather than UTC; but of course I don't know what else that might break. I guess a proper fix would be more along the lines of handling DATE values as independent of timezone.

      Zimbra also emits X-MICROSOFT-CDO-ALLDAYEVENT:TRUE on these events; maybe that could be used?

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            rtandy Ryan Tandy
            Peer reviewer:
            Dave Cooper
            Integrator:
            Dan Poltawski
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated: