[SOLVED] Parsing Ical not working

HI there,

i am trying to initialize a scheduler with data from ical for testing purposes.
I’ve used the demo from https://docs.dhtmlx.com/scheduler/samples/01_initialization_loading/01_basic_init.html to setup a scheduler.

Parsing the JSON Data works fine and all is shown. But when i try to parse ical, i dont get any events.

scheduler.getEvents() shows the correct amount of events, but the objects are empty. Is there a setting how to parse the ical, so that dtstartm dtend and summary are correctly parsed?

Here my example:

scheduler.ical.parse(
“BEGIN:VCALENDAR VERSION:2.0 PRODID:-//dhtmlXScheduler//NONSGML v2.2//EN DESCRIPTION: BEGIN:VEVENT DTSTART:20220411T140000 DTEND:20220411T170000 SUMMARY:Meeting END:VEVENT BEGIN:VEVENT DTSTART:20220415 DTEND:20220418 SUMMARY:Conference END:VEVENT BEGIN:VEVENT DTSTART:20220424T090000 DTEND:20220424T100000 SUMMARY:Interview END:VEVENT END:VCALENDAR”
);

I was searching all examples and the forum. I could not find anything working, where only the easy ical string is parsed and displayed.

Thanks for your advices,

CodeZero

Hi,
The scheduler.ical.parse method does not load data into the scheduler, but returns an array of events (also note the correct ical format, it should be divided into lines https://docs.dhtmlx.com/scheduler/data_formats.html#ical):

const icalString = scheduler.ical.parse(
`BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//dhtmlXScheduler//NONSGML v2.2//EN
DESCRIPTION:
BEGIN:VEVENT
DTSTART:20220411T140000
DTEND:20220411T170000
SUMMARY:Meeting
END:VEVENT
BEGIN:VEVENT
DTSTART:20220415
DTEND:20220418
SUMMARY:Conference
END:VEVENT
BEGIN:VEVENT
DTSTART:20220424T090000
DTEND:20220424T100000
SUMMARY:Interview
END:VEVENT
END:VCALENDAR`
);

Please use the scheduler.parse(icalString) method to load events:

scheduler.parse(icalString);

Here is an example: https://snippet.dhtmlx.com/l0pjhgmp.

1 Like

Thanks its working.
My problem was really that i put Ical in one line and then didn’t got the events for the parser.

Big thanks for creating the example.

1 Like