How do I check what is in "device.calendar.ongoing" in on{x}?

72 views Asked by At

I want log the data in device.calendar.ongoing so I can debug a problem with my script. I have tried

if (device.calendar.ongoing.length > 0) {
    console.log("All items: " + JSON.stringify(device.calendar.ongoing));
}

but that returned

All items: [{}]

When I did

if (device.calendar.ongoing.length > 0) {
    console.log("All items: " + device.calendar.ongoing);
}

But that returned

All items: 0

Any ideas on what I am doing wrong?

1

There are 1 answers

0
Bastian Rang On BEST ANSWER

for an unknown reason stringify doen't always work with on{x}. I use

var events = device.calendar.ongoing;
for(var i=0;i<events.length;i++) {
    console.log(events[i].title+": "+events[i].description);
}

this works in my cases.