Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different calendars report different UTC times #123

Closed
ahartman opened this issue Feb 8, 2022 · 12 comments
Closed

Different calendars report different UTC times #123

ahartman opened this issue Feb 8, 2022 · 12 comments
Assignees
Labels
question Further information is requested

Comments

@ahartman
Copy link

ahartman commented Feb 8, 2022

Benjamin,
I just read issue 119. That seems very complex if you have different passwords for each calendar as in Include secure mode.
I solved this long time ago; I use an upcoming node for each calendar, set the results of the first in a flow variable, retrieve that while processing the second calendar and concatenate but calendar outputs!

But the above is not my issue. I stumble on something weird as I am trying to improve my logic handling the calendar events. See attached images. I have two events for test in two iCloud calendars, both on default timezone UTC.

Schermafbeelding 2022-02-08 om 11 05 55

I use your upcoming node with different configs for calendar 1 and 2.
The Test 1 event at 0900 local time is reported at 0700UTC, 2 hours difference.
The Test 2 event at 9000 local time is reported at 0800UTC, 1 hour difference.

However, both events produce the correct local time for the 'within' node. My only problem is I need to sort events at the start when I only have the UTC time; that sort is therefore wrong.

Schermafbeelding 2022-02-08 om 11 08 53

Any ideas?
Regards, André

@ahartman ahartman added the question Further information is requested label Feb 8, 2022
@naimo84
Copy link
Owner

naimo84 commented Feb 8, 2022

Dear André,

currently issue #119 will only be available for "normal" calDav Server ;) I also thought of implementing this for "icloud secure", but as you said, I've no idea how to handle the different passwords nicely...

regards to your timezone difference, I only know the icloud.com option for time zone directly at the event.

image

It seems, that both are at the same time, but they are reported as 11:00 and 20:00 UTC

image

Maybe that's the problem?

Otherwise the debug log would be useful :) Please be aware of the basic password. You can send me it via mail 👍

Greets,
Benjamin

@ahartman
Copy link
Author

ahartman commented Feb 8, 2022 via email

@ahartman
Copy link
Author

ahartman commented Feb 8, 2022

Benjamin,

Please observe attached screen image for an event from 1500 to 1600 local time.

Schermafbeelding 2022-02-08 om 15 27 39

What I see is that dtstart and dtend in 'originalEvent' are in local time.
EventStart is 2 hours before dtstart, while eventEend is at the same time as dtend.

Regards, André

@naimo84
Copy link
Owner

naimo84 commented Feb 8, 2022

André,

this looks really strange. I can't imagine how this happens. But I'll keep trying to find out why.
Can you find a tzid field in the array?

This is how it looks for my test events from above:
image

Regards,
Benjamin

@naimo84
Copy link
Owner

naimo84 commented Feb 8, 2022

Perhaps the debug output will give us more informations ;) https://naimo84.github.io/kalender-events/guide/debug.html

It will show us the ical Data like this

BEGIN:VCALENDAR
X-WR-CALNAME:test-EU
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//caldav.icloud.com//CALDAVJ 2207B638//EN
BEGIN:VEVENT
DTSTAMP:20220208T110043Z
SUMMARY:test-EU
TZID:Europe/Berlin
SEQUENCE:0
UID:024526F8-6056-4C56-A9B9-E800780B3CBB
CREATED:20220208T110043Z
DTSTART;TZID=Europe/Berlin:20220208T120000
DTEND;TZID=Europe/Berlin:20220208T130000
TRANSP:OPAQUE
END:VEVENT
BEGIN:VTIMEZONE
TZID:Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
END:VTIMEZONE
END:VCALENDAR    

But nevertheless I can't imagine, why the tzids should be different from dtstart to dtend...

@naimo84 naimo84 self-assigned this Feb 8, 2022
@ahartman
Copy link
Author

ahartman commented Feb 9, 2022

Benjamin,

Please find attached the .ics file of yesterday's example. I see no funny things in there.

Karina van Bouwel .txt

Looking in the msg.payload in Node-Red, I see timezone Europe/Brussels for both dtstart and dtend.
However, what I also see is that eventStart is now show 1 hour later than in yesterday's screen image at the correct time!
This must be tz-related as all entries show up correctly in my calendars.

Schermafbeelding 2022-02-09 om 07 59 02

Regards, André

@naimo84
Copy link
Owner

naimo84 commented Feb 9, 2022

André,

in some way this is funny ;)

the ics file looks correct, the tzid is correct, eventStart/end is correct now as they are UTC.

I have no idea, why yesterday is was an other result... Yesterday you triggered past 12 o'clock, today before 12. But this would be "really funny", if it's a timebased problem

@ahartman
Copy link
Author

ahartman commented Feb 10, 2022

Benjamin,
Good morning, the eventStart and eventEnd are this morning even more weird. EventStart is one hour too early and eventEnd one hour too late!

As example I give you an appointment for this morning 0800-0900, please observe the .ics file as .txt.

Papa Julien.txt

The next image displays the output from the upcoming node, eventSTart and eventEnd are wrong, dtstart and dtend and the associated time zones are OK.

Schermafbeelding 2022-02-10 om 07 56 23

The weird thing is that in the end correct datetimes are produced. The 'within node' display a start time of 0700; that is as intended as we open the door 1 hour before the first appointment of 080-0900, i.e. 0700.

Schermafbeelding 2022-02-10 om 08 01 15

Next, I tried the other calendar that I access in NodeRed. Events in that calendar do not display the eventStart, eventEnd issue.

Schermafbeelding 2022-02-10 om 08 14 15

The issue seems to be in one calendar but not in the other.

Finally, I include part of the log output.

removed for privacy
[log.txt]
removed for privacy

Curious if you come with any ideas.

Regards, André

@ahartman
Copy link
Author

Benjamin,

I am trying to dig out the original dtstart and dtend values out of the array in originalEvent.components. However, array[1] gives 'undefined'. Asking for the keys of that array gives the weird result ["jcal", et cetera] as in the image below. I am really lost here. Can you explain to me how to retrieve dtstart and dtend?

Schermafbeelding 2022-02-10 om 10 26 58

Regards, Andre

@ahartman
Copy link
Author

Benjamin,

I managed to extract dtstart and dtend but in a roundabout sort of way:

let tempArray = []
let tempBlok = {}

consultaties = flow.get("consultaties").concat(msg.payload)
consultaties = consultaties.filter(event => event.allDay !== true)
consultaties.forEach(function (consultatie) {
component = consultatie.originalEvent.component
components = Object.entries(component)
elements = components[0][1][1]

for (const element of elements) {
    if (element[0] == "dtend") {
        dtend = element[3]
    }
    if (element[0] == "dtstart") {
        dtstart = element[3]
    }
}
tempBlok = {
    summary: consultatie.summary,
    dtstart: dtstart,
    dtend: dtend,
    eventStart: consultatie.eventStart,
    eventEnd: consultatie.eventEnd
}
tempArray.push(tempBlok)

})
consultaties = testArray.sort((a,b) => new Date(a.dtstart) - new Date(b.dtstart))
node.warn(consultaties)

In image below you can see the output:

Schermafbeelding 2022-02-10 om 10 26 58

The event "Sanne Spetters" is from the calendar that is ok; the event "Gaby Baetens" is from the one that where eventStart and evenend are wrong.

Regards, André

@ahartman
Copy link
Author

ahartman commented Feb 11, 2022

Benjamin,

Tried again this morning (Friday); for an appointment 1000-1100 I see startEvent at 0900UTC and endEvent at 1000UTC, both correct. The problem seems to have disappeared at least for today.

Regards, André

@naimo84
Copy link
Owner

naimo84 commented Feb 11, 2022

André,

happy to read, it disappeared ;) Even if I don't understand why ;)
I tried it yesterday in the morning, in the evening and today in the morning.
I always got an valid response like this

image

And thanks for the Log File 👍 But I don't see any error in it.
I'll look at it again but, nevertheless, this is a concern...

I'll close this in a week, if I don't hear anything from you. Hopefully ;))

Greets, Benjamin

@naimo84 naimo84 closed this as completed Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants