Read the statement by Michael Teeuw here.
Calendar timezone problems
-
I’m using the default MM calendar and having problems with it displaying event timezones properly.
I am displaying a work calendar and for the most part my co-workers are in ET while I am in CT - a 1 hour difference. When they create an event for me MM shows the time in ET as it was created, not in CT where myself and the MM are located.
For example, if someone creates and event that starts at 2pm ET that would be 1pm CT for me. However, when MM refreshes and displays the relative time it is 1 hour off.
Example:
event scheduled for 2pm ET/1pm CT
current time 1:15pm ET/12:15pm CT
MM displays the event starting in 2 hoursAnother example:
same event scheduled for 2pm ET/1pm CT
current time 2:05pm ET/1:05pm CT
MM displays the event starting in 55 minSo it appears that MM is reading the timezone the event was created in not the timezone of the pi (as I have verified the pi has the correct CT setting).
Any ideas how to fix this? Any other calendar module that might handle this differently such as jclarke0000/MMM-MyCalendar?
I note that the calendar module uses ical.js so any change there is a bug in it?
-
Just a quick update and I have tested MMM-MyCalendar from jclarke0000 and it does not work either. It shows the same 1 hour discrepency.
-
I’ve solved this problem by replacing the node-ical script that the default calendar modules uses with a fork of it.
I did some research and found that the default calendar module uses the node-ical modules to parse calendar data. I notice that it is based off of https://github.com/peterbraden/ical.js. I also found https://github.com/jens-maus/node-ical that is based off of the original peterbraden/ical.js. but seems to have been updated to use the npm package moment-timezone.
I did a drop in replacement and it seems to work:
cd modules/default/calendar/vendor
mv ical.js ical.js.orig
git clone https://github.com/jens-maus/node-ical
mv node-ical/ ical.js
cd ical.js
npm installRestarted MM and now my timezones are showing up properly. So I made my own modules out of this so it won’t get overwritten by updates.
-
@mlcampbe said in Calendar timezone problems:
i
Didnt work for me unfortunately, followed your instructions to a T. Same thing. I have an entry that tomorrow that is still showing incorrectly.
Little outta my depth, going to check the other cal modules to see if they parse the cal differently.
The only other thing I can think of is my firm is US and I am based in the UK. Office 365 has my region set correctly to UK.
-
@mlcampbe said in Calendar timezone problems:
I’ve solved this problem by replacing the node-ical script that the default calendar modules uses with a fork of it.
…
Just wanted to say thanks… I had updated my MM recently, and my calendar TZ broke as a result (using multiple different google calendars). Quick google search and I found this post. The fix worked perfectly for me. All my events show the correct TZ corrected time now.
-
@mlcampbe Just found this whilst googling. The solution doesn’t work for me either. It’s a tad frustrating.
I’ve tried with both a google calendar and O365 calendar and both produce the same results (UK time displayed whereas my timezone is Paris).
-
@mlcampbe said in Calendar timezone problems:
I’ve solved this problem by replacing the node-ical script that the default calendar modules uses with a fork of it.
I did some research and found that the default calendar module uses the node-ical modules to parse calendar data. I notice that it is based off of https://github.com/peterbraden/ical.js. I also found https://github.com/jens-maus/node-ical that is based off of the original peterbraden/ical.js. but seems to have been updated to use the npm package moment-timezone.
I did a drop in replacement and it seems to work:
cd modules/default/calendar/vendor
mv ical.js ical.js.orig
git clone https://github.com/jens-maus/node-ical
mv node-ical/ ical.js
cd ical.js
npm installRestarted MM and now my timezones are showing up properly. So I made my own modules out of this so it won’t get overwritten by updates.
I have a problem with the google ical calendar format, its 1 hour off when its used in MMM-CalendarEXT2, but I think it has something to do with winter/summer time.
Can the quote fix this problem?I can see in the folder " ~/MagicMirror/modules/MMM-CalendarExt2/node_modules " that there is a file called ical.js, but how to i update the file to the one in the qoute, so i can test if thats is the problem?
My pi has timezone to Europe / Copenhagen, and the calender entry is ok when i look at my phones calender and also ok on the google calender.
-
@bravooscar is the default calendar ok? I have done a lot of work to get that fixed over the last few releases…
calext2 is no longer maintained…
-
@sdetweil Yes default calendar is ok,so it has to be CalendarEXT2 that has a problem, and it could be the ical.js from above that could help?
-
@bravooscar sorry, no idea.
MM moved away from ical.js when it couldn’t handle some of the requirements from multiple calendar sources. even then I added a lot of code to handle tz and daylight savings shifts