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

Timezone setting in Office 365 causes error in calendar module #864

Closed
Hermpi opened this issue Apr 21, 2017 · 12 comments
Closed

Timezone setting in Office 365 causes error in calendar module #864

Hermpi opened this issue Apr 21, 2017 · 12 comments

Comments

@Hermpi
Copy link

Hermpi commented Apr 21, 2017

Hi,

I have is some troubles to get my private calendar displaying on the MM and I think there is something wrong with Ical handler. For all additional information see my discussion with Cohron on the forum:
https://forum.magicmirror.builders/topic/2347/office-365-calendar-issues/8

I'm able to get all my appointment showing up at the screen but the they all have a invalid value: "End in Invalid date". Only if I set my setting in Office 365 to timezone: UTC "Coordinated Universal Time" or set the appointment as All day event, the date is showing correctly. I looked in the ical files and the only difference I found between the working and not working appointments are the DTSTART & DTEND. I know this the line were the actually timing data is come from and the following line seems not to work:
DTSTART;TZID="(UTC+01:00) Amsterdam, Berlijn, Bern, Rome, Stockholm, Wenen":2
0170418T080000
but this will work [time zone set to UTC]:
DTSTART;TZID=UTC:20170422T083000

Could it be that the code that gets the data from DTSTART isn't able subtract the timing because the timingzone is between brackets?

Small Update
This only happens when you set the time zone to a zone that has multiple cities. So can someone tell me if this is something we need to fix here or by my big friends... from Microsoft?

Running MM v2.1.0 on Raspi 3

@tgabben
Copy link

tgabben commented May 7, 2017

I'm seeing the same symptom. I tried to feed the calendar module an O365 .ics file, and it's showing me a string of appointments in the past as 'upcoming' and all with the 'Ends in Invalid Date'.

It does appear that all of these unwanted (and mostly long passed) events have in common a TZID that states UTC offset but then specifies Time Zone and Cities/Countries, i.e. "(UTC-5:00) Eastern Time (US & Canada)".

This is discussed here: https://icalevents.com/2613-what-every-developer-ought-to-know-about-timezones-wrt-calendar-files/

I very much doubt that MSFT are going to change the way they output TZID values - but in theory, it should be possible to take the TZID values in quotes and convert them to something the calendar module knows what to do with, correct?

Context:
DTSTART;TZID="(UTC-05:00) Eastern Time (US & Canada)":20170324T123000
DTEND;TZID="(UTC-05:00) Eastern Time (US & Canada)":20170324T130000

^ no good - is in the past, but is currently showing on the list and "Ends in Invalid Date"

DTSTART;TZID=Atlantic Standard Time:20170510T160000
DTEND;TZID=Atlantic Standard Time:20170510T190000

^ shows as 'In 3 Days', as well it should.

@Hermpi
Copy link
Author

Hermpi commented May 8, 2017

They have already did a Pull request to fix this issue. My O365 calendar works perfect now.

See: #875

I think they will implement it with the next update for MM. I replace the two files (ical.js & node-ical.js) manually.

@tgabben
Copy link

tgabben commented May 8, 2017

Unfortunately, those modified ical.js & node-ical.js files don't address the issue I'm having with events persisting in the display with "Ends in Invalid date". The original issue does appear to have been related to Exchange calendars, but I'm not seeing any relief from what appears to be an issue with the TZID format.

@Hermpi
Copy link
Author

Hermpi commented May 9, 2017

Okay I get what your problem is. I delete all events in the past from my calendar to be sure this doesn't cause a problem. I my case there were upcoming and past events displayed with the invalid date error. I will add a event in the past in my calendar and when I come home from work I will check what the MM displayed.

@tgabben
Copy link

tgabben commented May 9, 2017

Ah - unfortunately, clearing all past events isn't entirely practical or feasible for me.

Additionally - as you've acknowledged - the problem exists for upcoming events as well as past events. Not only are there past meetings junking up the list, but there are one or two upcoming meeting invites in there, too - showing as "Ends in Invalid date" because they were created in Eastern Time by a colleague in that time zone.

@B4ttleduck
Copy link

B4ttleduck commented Aug 3, 2017

Same problem here, not O365 but the regular outlook Calendar.
Replacing the 2 files didn't work :(

[Edit1] timezone (in clock.js) set to null. (living in the Netherlands)

roramirez referenced this issue in eouia/MMM-CalendarExt Aug 10, 2017
@loctruong96
Copy link

loctruong96 commented Sep 9, 2017

I am having the exact same problem as you guys are having and replacing the new files update didn't help either. However, I have found a reasonable workaround for this problem by redirecting all events to a google calendar.

  1. Import office 365 calendar into a google calendar, this will take care of past events
  2. go to https://flow.microsoft.com/ and setup a flow trigger that will create a new event in google calendar whenever an event in office 365 is created. guide example (https://shift.newco.co/sync-your-calendars-using-microsoft-flow-and-yes-google-calendar-works-too-a28be5a604dd)
  3. Go to google calendar and create a private address to use in the calendar module for magic mirror.
    NOTE: Trigger will run every 5 minutes. Make sure to give it sometimes after you create a new test event in office 365 to appear in google calendar. Past google calendar will NOT be created using flow, only future events.

@MichMich
Copy link
Collaborator

Great workaround by @loctruong96. We'll add it to the Wiki. If somebody wants to create a real fix, feel free to send a PR. Closing this issue for now.

@pkkid
Copy link

pkkid commented Jan 1, 2018

To continue this discussion a bit. -- Will the workaround mentioned in @loctruong96's comment work if an event is updated (moved) to a new time?

@Hermpi
Copy link
Author

Hermpi commented Jan 3, 2018

Hey guys,

A couple weeks ago my Raspberry crashed and I had to reinstall everything included MM. The replacing of the two files didn't work anymore. So I did the same as @loctruong96 mentioned. This works great with one major downside! In my phone every events comes up twice....

I just switch jobs so I had to implement my new work calendar (regular outlook agenda). I will look at this in the weekend maybe I find some other workaround. I keep you updated ;)

@tgabben
Copy link

tgabben commented Jan 4, 2018

@pkkid - the O365 workflow mentioned serves to create new events on a google calendar only - it has no knowledge of updates/changes, and doesn't alter existing events on the associated google calendar. Any modifications to events have to be made via the google calendar itself.

It's an imperfect workaround, but it seems to be all we've got for the moment.

@pkkid
Copy link

pkkid commented Jan 4, 2018

FWIW, I made another workaround using the html link o365 provides. Perhaps I can make it a Herkou app or something if there is demand.

Essentially, I used an ajax call from the HTML o365 calendar that returns a list of all events in a given time frame in json format and recurring events denormalized. I wrote a quick passthough on my webserver that reads these events and serves a new ics calendar with normal formatting and dates. Magic Mirror seems to be reading them fine, and since it gets the most up to date information on o365 every time, it'll have all updates (not just creates). So it seems perfect as a read only setup.

If you're interested to try it out, or just want the Python code I used to do it all, send me a pm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants