bitfireAT/ical4android

Time of Event not correct with Events from Wordpress Events Manager

Opened this issue · 3 comments

Discussed in bitfireAT/icsx5#149

Originally posted by derlucas April 21, 2023
I have trouble using the App with Calendars from Events Manager Wordpress Plugin.
The Events are saved with Timezone "Berlin" at 19:00 and shown correctly on the Wordpress Site. In the ICS file the Entry is like this:

DTSTART;TZID=Europe/Berlin:20230421T190000 DTEND;TZID=Europe/Berlin:20230421T235900

But in my Android Calendar (Simple Mobile Tools Calendar the Event is show at 01:00 in the night instead of 19:00. I tested the Google Calendar App too, and it shows the same false Time.

What would be the best way to find the root of the Issue?

Depends on ical4j/ical4j#651

Could reproduce the problem.

@ArnyminerZ Can you please create a new JUnit test that runs outside Android instrumentation (in test, not androidTest) and doesn't require any ical4android methods to test parsing of:

VERSION:2.0
BEGIN:VEVENT
UID:xxx@xxx.de
DTSTART;TZID=Europe/Berlin:20230905T200000
DTEND;TZID=Europe/Berlin:20230905T210000
SUMMARY:xxxxxxxxxxxxxxxxxxx
END:VEVENT
BEGIN:VTIMEZONE
TZID:Europe/Berlin
BEGIN:DAYLIGHT
DTSTART:20230326T030000
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:20231029T020000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:20240331T030000
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:20241027T020000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
END:STANDARD
END:VTIMEZONE
END:VCALENDAR

If you then get the dtStart.value, it should be at 20⁰⁰ like this:

val e = c.getComponent<VEvent>(Component.VEVENT)
assertEquals("20230905T200000", e.startDate.value)

However it's at 01⁰⁰ here. If you can confirm, please create an issue in ical4j with the ical4android-independent test and mark this issue as dependence.

I've created this test:

class WordpressEventsManagerTest {
    @Test
    fun test_parsing() {
        val calendar = CalendarBuilder().build(
            StringReader(
                "BEGIN:VCALENDAR\n" +
                    "VERSION:2.0\n" +
                    "BEGIN:VEVENT\n" +
                    "UID:xxx@xxx.de\n" +
                    "DTSTART;TZID=Europe/Berlin:20230905T200000\n" +
                    "DTEND;TZID=Europe/Berlin:20230905T210000\n" +
                    "SUMMARY:xxxxxxxxxxxxxxxxxxx\n" +
                    "END:VEVENT\n" +
                    "BEGIN:VTIMEZONE\n" +
                    "TZID:Europe/Berlin\n" +
                    "BEGIN:DAYLIGHT\n" +
                    "DTSTART:20230326T030000\n" +
                    "TZOFFSETFROM:+0100\n" +
                    "TZOFFSETTO:+0200\n" +
                    "TZNAME:CEST\n" +
                    "END:DAYLIGHT\n" +
                    "BEGIN:STANDARD\n" +
                    "DTSTART:20231029T020000\n" +
                    "TZOFFSETFROM:+0200\n" +
                    "TZOFFSETTO:+0100\n" +
                    "TZNAME:CET\n" +
                    "END:STANDARD\n" +
                    "BEGIN:DAYLIGHT\n" +
                    "DTSTART:20240331T030000\n" +
                    "TZOFFSETFROM:+0100\n" +
                    "TZOFFSETTO:+0200\n" +
                    "TZNAME:CEST\n" +
                    "END:DAYLIGHT\n" +
                    "BEGIN:STANDARD\n" +
                    "DTSTART:20241027T020000\n" +
                    "TZOFFSETFROM:+0200\n" +
                    "TZOFFSETTO:+0100\n" +
                    "TZNAME:CET\n" +
                    "END:STANDARD\n" +
                    "END:VTIMEZONE\n" +
                    "END:VCALENDAR"
            )
        )

        val event = calendar.getComponent<VEvent>(Component.VEVENT)
        assert(event.startDate.value == "20230905T200000") {
            "Start date does not match. Expected: <20230905T200000>. Actual: <${event.startDate.value}>"
        }
    }
}

And it fails with Start date does not match. Expected: <20230905T200000>. Actual: <20230905T010000>, so yeah, I can confirm

This PR/issue depends on: