jQWidgets Forums

jQuery UI Widgets Forums Scheduler ICAL expression RRULE not working correctly

This topic contains 3 replies, has 2 voices, and was last updated by  Hristo 5 years, 11 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • TDS
    Participant

    Hello,

    I think the iCal parser or the calculation for the views is broken.

    iCal example:

    
    BEGIN:VCALENDAR
    PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
    VERSION:2.0
    BEGIN:VTIMEZONE
    TZID:Europe/Berlin
    BEGIN:DAYLIGHT
    TZOFFSETFROM:+0100
    TZOFFSETTO:+0200
    TZNAME:CEST
    DTSTART:19700329T020000
    RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
    END:DAYLIGHT
    BEGIN:STANDARD
    TZOFFSETFROM:+0200
    TZOFFSETTO:+0100
    TZNAME:CET
    DTSTART:19701025T030000
    RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
    END:STANDARD
    END:VTIMEZONE
    BEGIN:VEVENT
    CREATED:20190404T180240Z
    LAST-MODIFIED:20190404T180307Z
    DTSTAMP:20190404T180307Z
    UID:06923ad6-952a-4028-b4d7-6530f8e0bef3
    SUMMARY:Rangliste Offen / Gilde 2000
    RRULE:FREQ=MONTHLY;BYDAY=-1FR
    DTSTART;TZID=Europe/Berlin:20190410T193000
    DTEND;TZID=Europe/Berlin:20190410T235900
    TRANSP:OPAQUE
    LOCATION:Gilde 2000
    END:VEVENT
    END:VCALENDAR
    

    Expected: Every last friday in month at 19:30 (7:30 pm).
    Result (incorrect):
    Result

    iCal library:

    
    var comp = new ICAL.Component(calData);
    var eventComps = comp.getAllSubcomponents("vevent");
    // console.log(JSON.stringify(eventComps));
    // map them to FullCalendar events
    eventComps.forEach(function(vevent) {
    	var counter = 0;
    	const iCalEvent = new ICAL.Event(vevent);
    		if (!vevent.hasProperty('dtstart')) {
    		return;
    	}
    	// ...
    
    	if (iCalEvent.isRecurring()) {
    		// ...
    		var next;
    		var expand = new ICAL.RecurExpansion({
    			component: vevent,
    			dtstart: vevent.getFirstPropertyValue('dtstart')
    		});
    		while ((next = expand.next())) {
    			if (counter++ > 3) break;
    			console.log(next._time); // correct
    			// ...
    			// push event into some array
    		}
    	} else {
    		// ...
    		// push event into some array
    	}
    });
    

    Result of Mozilla iCal library (ical.min.js, correct):
    {year: 2019, month: 4, day: 26, hour: 19, minute: 30, …}
    {year: 2019, month: 5, day: 31, hour: 19, minute: 30, …}
    {year: 2019, month: 6, day: 28, hour: 19, minute: 30, …}
    {year: 2019, month: 7, day: 26, hour: 19, minute: 30, …}


    Hristo
    Participant

    Hello TDS,

    The data that you provided is not fully compatible.
    For example, the date you set is “Unparseable date” if you try to check it with some of the online ‘ICAL’ validators.
    Could you provide us with a working example in jsfiddle/jseditor?
    You could use this one as a base.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com


    TDS
    Participant

    Sorry for late replay, but I’ve had holidays 😉
    The data is from Lightning export of Mozilla Thunderbird. And the ICAL library is also from Mozilla. They try to cover all ICS date in the wild. So it should be correct considering RFC 2445 and 5445.


    Hristo
    Participant

    Hello TDS,

    There have different standards.
    We tested and it seems to work fine with “Microsoft Outlook” and “Google Calendar”.
    I would like to suggest you could export from them and import to our jqxScheduler.
    Or if you want also could do it in the opposite direction.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.