MagicMirror icon indicating copy to clipboard operation
MagicMirror copied to clipboard

On day of event, Calendar doesn't show recurring events starting within TZ difference from midnight (static calendar)

Open castletonroad opened this issue 6 years ago • 49 comments

Platform: Raspberry Pi 4, 2 GB, Raspbian 10 (buster); Electron 6.1.12

Node Version: 10.22.0

MagicMirror Version: 2.13.0-develop

Description: On the day of an event, Calendar module does not show any recurring events where the start time is BEFORE 10am - these events start within the TZ difference (10hrs) from midnight. (My TZ is AEST, currently GMT+10.00). If the event is NOT recurring, it will show on the MM. If the event IS recurring, but starts after 10.00, it will also show on the MM

Steps to Reproduce:

  1. Create a new recurring (two-weekly, 4 occurrences, 09.20-10.15) event (via either of iPhone Calendar app, or Nextcloud web-based Calendar app) for next day - recurring event shows correctly on the MM ('Tomorrow at 09.20').
  2. On the day of the event, the recurring event starting before 10.00 does not show; any recurring event starting after 10.00 shows correctly.
  3. Create a NON-recurring event for same day (09.20-10.15) and restart the MM - the event shows correctly on the MM.
  4. Make this event RECURRING and restart the MM - the event DOES NOT show.
  5. Change this event's start time to 10.30 (vs. 09.20) - this recurring event shows correctly on the MM!
  6. Change start time to 10.05 - recurring event shows correctly on the MM.
  7. Change start time to 10.00 - recurring event shows correctly on the MM.
  8. Change start time to 09.55 - recurring event DOES NOT show on the MM.
  9. Remove the recurrence from the event - recurring event shows correctly on the MM.

Expected Results: Single instance events starting before 10.00 show correctly on the MM Recurring events starting before 10.00 show correctly on the MM Recurring events starting on/after 10.00 show correctly on the MM

Actual Results: Single instance events starting before 10.00 show correctly on the MM Recurring events starting before 10.00 DO NOT show on the MM Recurring events starting on/after 10.00 show correctly on the MM

Configuration: What does the used config.js file look like? Don't forget to remove any sensitive information! NextCloud: 18.0.06, Calendar App 2.0.3

Export of .ICS file to MM/modules/default/calendar folder (so using a static calendar)

~/MagicMirror/config/config.js:

            {
                    module: "calendar",
                    header: "School Timetable",
                    position: "top_right",
                    config: {
                            calendars: [
                                    {
                                            symbol: "calendar-check-o ",
                                            url: "webcal://127.0.0.1:8080/modules/default/calendar/school-timetable.ics"
                                    }
                            ]
                    }
            },

Additional Notes: Non-recurrent event that shows correctly before 10.00: BEGIN:VEVENT CREATED:20200806T235605Z DTEND;TZID=Australia/Sydney:20200807T100000 DTSTAMP:20200806T235856Z DTSTART;TZID=Australia/Sydney:20200807T090000 LAST-MODIFIED:20200806T235856Z SEQUENCE:1 SUMMARY:Test5 TRANSP:OPAQUE UID:8BDDEF67-33C4-4C32-B5D4-F7D31D83B490 URL;VALUE=URI: LOCATION:TESTING END:VEVENT

Recurrent event that does not show correctly before 10.00: BEGIN:VEVENT CREATED:20200806T235535Z DTEND;TZID=Australia/Sydney:20200807T100000 DTSTAMP:20200806T235842Z DTSTART;TZID=Australia/Sydney:20200807T090000 LAST-MODIFIED:20200806T235842Z RRULE:FREQ=WEEKLY;INTERVAL=2;UNTIL=20200925T135959Z SEQUENCE:1 SUMMARY:Test4 recurrent TRANSP:OPAQUE UID:E7A31472-B600-4EC6-B06E-19A054343989 URL;VALUE=URI: LOCATION:TESTING END:VEVENT

I see that CREATED date time shows as 10hrs behind by TZ, so GMT

This may be the same issue as for #2110.

castletonroad avatar Aug 07 '20 00:08 castletonroad

Can I close this issue?

MichMich avatar Sep 22 '20 09:09 MichMich

Hi, I'm not clear how the matter has been fixed? My MM is fully up-to-date but the issue persists.

Did I miss the solution?

Thanks :)

castletonroad avatar Sep 22 '20 09:09 castletonroad

Did you try the develop branch of MM?

rejas avatar Sep 22 '20 09:09 rejas

Did you try the develop branch of MM?

I'm not so experienced with git. Happy to try that if you could point me in the right direction of how to..?

Thanks very much.

castletonroad avatar Sep 22 '20 10:09 castletonroad

this issue can be closed

sdetweil avatar Sep 22 '20 12:09 sdetweil

Apologies - how do I 'try the develop branch of MM'?

Thank you.

castletonroad avatar Sep 23 '20 10:09 castletonroad

In your MagicMirror folder try the following commands: git checkout develop && git pull

MichMich avatar Sep 23 '20 10:09 MichMich

In your MagicMirror folder try the following commands: git checkout develop && git pull

Thank you very much for the very quick reply.

MM now runs to a blank screen with a mouse cursor dead-centre. :(

castletonroad avatar Sep 23 '20 10:09 castletonroad

Maybe try npm install

MichMich avatar Sep 23 '20 11:09 MichMich

Maybe try npm install

Great - MM back up and running! (I'll remember that...)

However, my recurrent events are STILL messed up. For example, it is currently 21:22 (I am AEST, i.e. GMT+9h) but my weekly recurring 10.15-10.30am appointment from this morning is showing as 'Ends in 3 hrs'!

Let me see how things look first thing in the morning...

castletonroad avatar Sep 23 '20 11:09 castletonroad

@castletonroad

can u make a sample ics with a calendar block and a vevent block that shows the problem

I will work to resolve before mm release next week. u can paste the text here, or email to me. same userid on gmail

sdetweil avatar Sep 23 '20 11:09 sdetweil

@castletonroad

can u make a sample ics with a calendar block and a vevent block that shows the problem

I will work to resolve before mm release next week. u can paste the text here, or email to me. same userid on gmail

Hi - thanks for looking at this.

This should be a recurring event, every Weds 10:15 to 10:30, 10 instances, ending today:

BEGIN:VCALENDAR PRODID:-//Microsoft Corporation//Outlook 16.0 MIMEDIR//EN VERSION:2.0 METHOD:PUBLISH X-CALSTART:20200719T222500Z X-CALSTART:20200720T000000 X-CALEND:20280825T000000 X-WR-RELCALID:{0000002E-4069-AC36-7A41-8D022446F3D7} X-WR-CALNAME:School Timetable BEGIN:VTIMEZONE TZID:Australia/Sydney BEGIN:STANDARD DTSTART:16010401T030000 RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 TZOFFSETFROM:+1100 TZOFFSETTO:+1000 END:STANDARD BEGIN:DAYLIGHT DTSTART:16011007T020000 RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=10 TZOFFSETFROM:+1000 TZOFFSETTO:+1100 END:DAYLIGHT END:VTIMEZONE BEGIN:VEVENT CLASS:PUBLIC CREATED:20200830T150748Z DTEND;TZID=Australia/Sydney:20200722T103000 DTSTAMP:20200625T233123Z DTSTART;TZID=Australia/Sydney:20200722T101500 LAST-MODIFIED:20200920T021150Z LOCATION:School PRIORITY:5 RRULE:FREQ=WEEKLY;COUNT=10;BYDAY=WE SEQUENCE:0 SUMMARY;LANGUAGE=en-us:P3 - Lesson TRANSP:OPAQUE UID:ec400f81-02d5-46b0-ba6a-22f4d007c07d X-MICROSOFT-CDO-BUSYSTATUS:BUSY X-MICROSOFT-CDO-IMPORTANCE:1 END:VEVENT END:VCALENDAR

castletonroad avatar Sep 23 '20 12:09 castletonroad

ok, I can't recreate that. because its sept 23, wed, the wed morning event has passed, so next in 6 days.. I set my time to AEST (which is +10, not +11)

can u check three things

  1. edit ~/MagicMirror/modules/default/calendar/calendarfetcher.js line 8 should be
const ical = require("node-ical");
  1. ls ~/MagicMirror/node_modules/node-ical

  2. git branch should show

* develop
  master

sdetweil avatar Sep 23 '20 12:09 sdetweil

  1. Yes: const ical = require("node-ical");

  2. This:

pi@raspberrypi2:~ $ ls ~/MagicMirror/node_modules/node-ical
ical.js  LICENSE  node-ical.d.ts  node-ical.js  node_modules  package.json  README.md  SECURITY.md  windowsZones.json
  1. This:
pi@raspberrypi2:~ $ git branch
fatal: not a git repository (or any of the parent directories): .git

castletonroad avatar Sep 23 '20 20:09 castletonroad

git branch from inside the MM folder.. , but u have the new code.. hmm...

weird... want to do some quick debugging

edit calendarfetcher.js

add a line , new line at line 97

			Object.entries(data).forEach(([key, event]) => {
				const now = new Date();
				const today = moment().startOf("day").toDate();
				const future = moment().startOf("day").add(maximumNumberOfDays, "days").subtract(1, "seconds").toDate(); // Subtract 1 second so that events that start on the middle of the night will not repeat.
				let past = today;

				console.log("event="+JSON.stringify(event))   // < --- add this line

also at approx line 219

						const dates = rule.between(pastLocal, futureLocal, true, limitFunction);

						console.log("rule dates="+ JSON.stringify(dates))  // < --- add this line

then start mm

npm start >somefile

after the calendar displays

copy/paste the somefile here... or attach it..

mine looks like

[2020-09-23 15:06:23.911] [LOG]    event=["20200719T222500Z","20200720T000000"]
[2020-09-23 15:06:23.911] [LOG]    event={"type":"VTIMEZONE","params":[],"tzid":"Australia/Sydney","9ebb6868-92f1-43a4-b975-426446220014":{"type":"STANDARD","params":[],"start":"1601-04-01T08:50:36.000Z","datetype":"date-time","rrule":"RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4","tzoffsetfrom":"+1100","tzoffsetto":"+1000"},"d55b9c18-ef77-4d10-89d8-0f63dfec94c2":{"type":"DAYLIGHT","params":[],"start":"1601-10-07T07:50:36.000Z","datetype":"date-time","rrule":"RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=10","tzoffsetfrom":"+1000","tzoffsetto":"+1100"}}

[2020-09-23 15:06:23.911] [LOG]    event={"type":"VEVENT","params":[],"class":"PUBLIC","created":"2020-08-30T15:07:48.000Z","end":"2020-07-22T00:30:00.000Z","dtstamp":"2020-06-25T23:31:23.000Z","start":"2020-07-22T00:15:00.000Z","datetype":"date-time","lastmodified":"2020-09-20T02:11:50.000Z","location":"School","priority":"5","rrule":{"_cache":{"all":false,"before":[],"after":[],"between":[]},"origOptions":{"dtstart":"2020-07-22T00:15:00.000Z","freq":2,"count":15,"byweekday":[{"weekday":3}]},"options":{"freq":2,"dtstart":"2020-07-22T00:15:00.000Z","interval":1,"wkst":0,"count":15,"until":null,"bysetpos":null,"bymonth":null,"bymonthday":[],"bynmonthday":[],"byyearday":null,"byweekno":null,"byweekday":[3],"bynweekday":null,"byhour":[0],"byminute":[15],"bysecond":[0],"byeaster":null}},"sequence":"0","summary":{"params":{"LANGUAGE":"en-us"},"val":"P3 - Lesson"},"transparency":"OPAQUE","uid":"ec400f81-02d5-46b0-ba6a-22f4d007c07d","MICROSOFT-CDO-BUSYSTATUS":"BUSY","MICROSOFT-CDO-IMPORTANCE":"1"}

[2020-09-23 15:06:23.912] [LOG]     tz offsets past=300 future=300
[2020-09-23 15:06:23.917] [LOG]    rule dates=["2020-09-24T00:15:00.000Z","2020-10-01T00:15:00.000Z","2020-10-08T00:15:00.000Z","2020-10-15T00:15:00.000Z","2020-10-22T00:15:00.000Z","2020-10-29T00:15:00.000Z"]

blank lines added by me (my rrule says thursday) RRULE:FREQ=WEEKLY;COUNT=15;BYDAY=TH

sdetweil avatar Sep 23 '20 20:09 sdetweil

I added the lines (you had the correct locations).

pi@raspberrypi2:~/MagicMirror $ more somefile

> [email protected] start /home/pi/MagicMirror
> DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js

[2020-09-24 06:51:26.301] [LOG]    Starting MagicMirror: v2.13.0-develop
[2020-09-24 06:51:26.324] [LOG]    Loading config ...
[2020-09-24 06:51:26.340] [LOG]    Loading module helpers ...
[2020-09-24 06:51:26.346] [LOG]    No helper found for module: alert.
[2020-09-24 06:51:26.349] [LOG]    No helper found for module: clock.
[2020-09-24 06:51:27.889] [LOG]    Initializing new module helper ...
[2020-09-24 06:51:27.894] [LOG]    Module helper loaded: calendar
[2020-09-24 06:51:27.897] [LOG]    No helper found for module: compliments.
[2020-09-24 06:51:27.900] [LOG]    No helper found for module: currentweather.
[2020-09-24 06:51:27.901] [LOG]    No helper found for module: weatherforecast.
[2020-09-24 06:51:29.280] [LOG]    Initializing new module helper ...
[2020-09-24 06:51:29.282] [LOG]    Module helper loaded: MMM-NowPlayingOnSpotify
[2020-09-24 06:51:29.283] [LOG]    All module helpers loaded.
[2020-09-24 06:51:29.624] [LOG]    Starting server on port 8080 ...
[2020-09-24 06:51:29.666] [LOG]    Server started ...
[2020-09-24 06:51:29.669] [LOG]    Connecting socket for: calendar
[2020-09-24 06:51:29.671] [LOG]    Starting node helper for: calendar
[2020-09-24 06:51:29.672] [LOG]    Connecting socket for: MMM-NowPlayingOnSpotify
[2020-09-24 06:51:29.674] [LOG]    Sockets connected & modules started ...
[2020-09-24 06:51:30.039] [LOG]    Launching application.

castletonroad avatar Sep 23 '20 20:09 castletonroad

its after the launching application

[2020-09-23 15:06:19.007] [LOG]    Launching application.
 Create new calendar fetcher for url: http://localhost:8090/modules/default/calendar/australia.ics - Interval: 300000
[2020-09-23 15:06:23.808] [INFO]   Checking git for module: MMM-Ring
[2020-09-23 15:06:23.911] [LOG]    event=["20200719T222500Z","20200720T000000"]
[2020-09-23 15:06:23.911] [LOG]    event={"type":"VTIMEZONE","params":[],"tzid":"Australia/Sydney","9ebb6868-92f1-43a4-b975-426446220014":{"type":"STANDARD","params":[],"start":"1601-04-01T08:50:36.000Z","datetype":"date-time","rrule":"RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4","tzoffsetfrom":"+1100","tzoffsetto":"+1000"},"d55b9c18-ef77-4d10-89d8-0f63dfec94c2":{"type":"DAYLIGHT","params":[],"start":"1601-10-07T07:50:36.000Z","datetype":"date-time","rrule":"RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=10","tzoffsetfrom":"+1000","tzoffsetto":"+1100"}}
[2020-09-23 15:06:23.911] [LOG]    event={"type":"VEVENT","params":[],"class":"PUBLIC","created":"2020-08-30T15:07:48.000Z","end":"2020-07-22T00:30:00.000Z","dtstamp":"2020-06-25T23:31:23.000Z","start":"2020-07-22T00:15:00.000Z","datetype":"date-time","lastmodified":"2020-09-20T02:11:50.000Z","location":"School","priority":"5","rrule":{"_cache":{"all":false,"before":[],"after":[],"between":[]},"origOptions":{"dtstart":"2020-07-22T00:15:00.000Z","freq":2,"count":15,"byweekday":[{"weekday":3}]},"options":{"freq":2,"dtstart":"2020-07-22T00:15:00.000Z","interval":1,"wkst":0,"count":15,"until":null,"bysetpos":null,"bymonth":null,"bymonthday":[],"bynmonthday":[],"byyearday":null,"byweekno":null,"byweekday":[3],"bynweekday":null,"byhour":[0],"byminute":[15],"bysecond":[0],"byeaster":null}},"sequence":"0","summary":{"params":{"LANGUAGE":"en-us"},"val":"P3 - Lesson"},"transparency":"OPAQUE","uid":"ec400f81-02d5-46b0-ba6a-22f4d007c07d","MICROSOFT-CDO-BUSYSTATUS":"BUSY","MICROSOFT-CDO-IMPORTANCE":"1"}
[2020-09-23 15:06:23.912] [LOG]     tz offsets past=300 future=300
[2020-09-23 15:06:23.917] [LOG]    rule dates=["2020-09-24T00:15:00.000Z","2020-10-01T00:15:00.000Z","2020-10-08T00:15:00.000Z","2020-10-15T00:15:00.000Z","2020-10-22T00:15:00.000Z","2020-10-29T00:15:00.000Z"]
[2020-09-23 15:06:23.920] [INFO]   Calendar-Fetcher: Broadcasting 6 events.

sdetweil avatar Sep 23 '20 21:09 sdetweil

its after the launching application

[2020-09-23 15:06:19.007] [LOG]    Launching application.
 Create new calendar fetcher for url: http://localhost:8090/modules/default/calendar/australia.ics - Interval: 300000
[2020-09-23 15:06:23.808] [INFO]   Checking git for module: MMM-Ring
[2020-09-23 15:06:23.911] [LOG]    event=["20200719T222500Z","20200720T000000"]
[2020-09-23 15:06:23.911] [LOG]    event={"type":"VTIMEZONE","params":[],"tzid":"Australia/Sydney","9ebb6868-92f1-43a4-b975-426446220014":{"type":"STANDARD","params":[],"start":"1601-04-01T08:50:36.000Z","datetype":"date-time","rrule":"RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4","tzoffsetfrom":"+1100","tzoffsetto":"+1000"},"d55b9c18-ef77-4d10-89d8-0f63dfec94c2":{"type":"DAYLIGHT","params":[],"start":"1601-10-07T07:50:36.000Z","datetype":"date-time","rrule":"RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=10","tzoffsetfrom":"+1000","tzoffsetto":"+1100"}}
[2020-09-23 15:06:23.911] [LOG]    event={"type":"VEVENT","params":[],"class":"PUBLIC","created":"2020-08-30T15:07:48.000Z","end":"2020-07-22T00:30:00.000Z","dtstamp":"2020-06-25T23:31:23.000Z","start":"2020-07-22T00:15:00.000Z","datetype":"date-time","lastmodified":"2020-09-20T02:11:50.000Z","location":"School","priority":"5","rrule":{"_cache":{"all":false,"before":[],"after":[],"between":[]},"origOptions":{"dtstart":"2020-07-22T00:15:00.000Z","freq":2,"count":15,"byweekday":[{"weekday":3}]},"options":{"freq":2,"dtstart":"2020-07-22T00:15:00.000Z","interval":1,"wkst":0,"count":15,"until":null,"bysetpos":null,"bymonth":null,"bymonthday":[],"bynmonthday":[],"byyearday":null,"byweekno":null,"byweekday":[3],"bynweekday":null,"byhour":[0],"byminute":[15],"bysecond":[0],"byeaster":null}},"sequence":"0","summary":{"params":{"LANGUAGE":"en-us"},"val":"P3 - Lesson"},"transparency":"OPAQUE","uid":"ec400f81-02d5-46b0-ba6a-22f4d007c07d","MICROSOFT-CDO-BUSYSTATUS":"BUSY","MICROSOFT-CDO-IMPORTANCE":"1"}
[2020-09-23 15:06:23.912] [LOG]     tz offsets past=300 future=300
[2020-09-23 15:06:23.917] [LOG]    rule dates=["2020-09-24T00:15:00.000Z","2020-10-01T00:15:00.000Z","2020-10-08T00:15:00.000Z","2020-10-15T00:15:00.000Z","2020-10-22T00:15:00.000Z","2020-10-29T00:15:00.000Z"]
[2020-09-23 15:06:23.920] [INFO]   Calendar-Fetcher: Broadcasting 6 events.

That is all that I have in somefile.

I'm conscious that you think this issue is closed and yet I'm taking up your time.

I'll do a clean install of MM and see where that gets me.

Thanks for trying to help me with this.

castletonroad avatar Sep 23 '20 21:09 castletonroad

you have to switch to the develop branch even with a new install, the fixes are not promoted yet, on the 1st of Oct..

so, do you have two MagicMirror installations? cause I don't see the fetcher message either..

Create new calendar fetcher for url:

its ok, I just did a ton of work on the timezone adjustments and windows timezone names.. so I am familiar with the code, I am the best to do it.. nothing else going on (retired)...

I have to go watch grandson play hockey... back later

sdetweil avatar Sep 23 '20 21:09 sdetweil

you have to switch to the develop branch even with a new install, the fixes are not promoted yet, on the 1st of Oct..

so, do you have two MagicMirror installations? cause I don't see the fetcher message either..

Create new calendar fetcher for url:

its ok, I just did a ton of work on the timezone adjustments and windows timezone names.. so I am familiar with the code, I am the best to do it.. nothing else going on (retired)...

I have to go watch grandson play hockey... back later

Just the one installation. And it was all from a clean raspberryOS install a few months back - it's an old pi2 that does nothing else (I have a pi3 for fun and a pi4 as a mail server and vpn).

I'll do an clean install and switch to dev, then report back 👍

And thanks again for your help on this, and support across the whole MM project.

castletonroad avatar Sep 23 '20 21:09 castletonroad