MagicMirror² v2.11.0 is available! For more information about this release, check out this topic.
READ THE CHANGELOG BEFORE UPDATING!

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 hours

    Another example:
    same event scheduled for 2pm ET/1pm CT
    current time 2:05pm ET/1:05pm CT
    MM displays the event starting in 55 min

    So 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 install

    Restarted 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).


Log in to reply