bitfireAT / ical4android

Allows usage of iCalendar files with the Android calendar provider
GNU General Public License v3.0
18 stars 10 forks source link

Time of Event not correct with Events from Wordpress Events Manager #112

Open rfc2822 opened 1 year ago

rfc2822 commented 1 year ago

Discussed in https://github.com/bitfireAT/icsx5/discussions/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](https://github.com/SimpleMobileTools/Simple-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 https://github.com/ical4j/ical4j/issues/651

rfc2822 commented 1 year ago

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.

ArnyminerZ commented 1 year ago

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

github-actions[bot] commented 1 year ago

This PR/issue depends on: