• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Calendar events showing on wrong day.

Scheduled Pinned Locked Moved Unsolved Troubleshooting
66 Posts 3 Posters 17.8k Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Away
    sdetweil @flyedge
    last edited by Nov 18, 2021, 3:30 AM

    @flyedge can u post one event from the ICS file… use the URL in the cal setting in a browser, it downloads the ics, which is just text

    I want to see one

    BEGIN:VEVENT
    ...
    END:VEVENT
    

    Sam

    How to add modules

    learning how to use browser developers window for css changes

    F 1 Reply Last reply Nov 18, 2021, 7:07 PM Reply Quote 0
    • F Offline
      flyedge @sdetweil
      last edited by Nov 18, 2021, 7:07 PM

      @sdetweil This event shows on the 22nd at 6pm rather than the 23rd. I do notice that for some reason the event shows as Vancouver time zone rather than Edmonton, perhaps that could be affecting something (even though it should only be 1 hour different…)

      BEGIN:VEVENT
      DTSTART;TZID=America/Vancouver:20201126T170000
      DTEND;TZID=America/Vancouver:20201126T180000
      RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=23
      DTSTAMP:20211118T181948Z
      UID:55A45619-xxxxx-4425-xxxx-1EFBAFDC2DE0
      CREATED:20201119T060211Z
      DESCRIPTION:
      LAST-MODIFIED:20201119T060211Z
      LOCATION:
      SEQUENCE:0
      STATUS:CONFIRMED
      SUMMARY:Test
      TRANSP:OPAQUE
      END:VEVENT

      S 1 Reply Last reply Nov 18, 2021, 9:25 PM Reply Quote 0
      • S Away
        sdetweil @flyedge
        last edited by sdetweil Nov 18, 2021, 9:27 PM Nov 18, 2021, 9:25 PM

        @flyedge thanks… it seems a fix I put in early last year has been lost… trying to find out where…

        the library (not ours) that does repeating events, expects the date/time to be local time, no timezone

        we and the ics parse libraries expect the date/time to be utc time…

        so, your cal entry

        DTSTART;TZID=America/Vancouver:20201126T170000
        DTEND;TZID=America/Vancouver:20201126T180000
        RRULE:FREQ=MONTHLY;WKST=SU;BYMONTHDAY=23
        

        is processed

        Search for recurring events between: Thu Nov 18 2021 14:25:16 GMT-0600 (Central Standard Time) and Thu Nov 17 2022 23:59:59 GMT-0600 (Central Standard Time)

        Vancouver is -8, so 17+8-24 = 1 so utc time is next day +1

        [18.11.2021 14:25.16.441] [DEBUG] Title: Test, with dates:
        rrule returned dates

        [
        "2021-11-23T01:00:00.000Z",     next day +1.. except...  the start day was 23, so this should be 24:1 (-8) = 23/17:00
        
        so the luxon library didn't know about tz, and used the HOUR 1, as the repeating start time, on the 23rd.. 
        
        "2021-12-23T01:00:00.000Z",
        "2022-01-23T01:00:00.000Z",
        "2022-02-23T01:00:00.000Z","2022-03-23T01:00:00.000Z","2022-04-23T01:00:00.000Z","2022-05-23T01:00:00.000Z","2022-06-23T01:00:00.000Z","2022-07-23T01:00:00.000Z","2022-08-23T01:00:00.000Z","2022-09-23T01:00:00.000Z","2022-10-23T01:00:00.000Z"]
        

        if u change your system tz to Vancouver it should come out correct…

        to temp fix, try this

        edit modules/default/calendar/calendarutils.js

        there are two occurrences (approx line 348 and line 376) of this code

        								// if the timezones are the same, correct date if needed
        								if (event.start.tz === moment.tz.guess()) {
        									// if the date hour is less than the offset
        									if (24 - dh <= Math.abs(dateoffset / 60)) {
        										// apply the correction to the date/time back to right day
        										date = new Date(date.getTime() + Math.abs(24 * 60) * 60000);
        										// the duration was calculated way back at the top before we could correct the start time..
        										// fix it for this event entry
        										//duration = 24 * 60 * 60 * 1000;
        										Log.debug("new recurring date2 is " + date);
        									}
        								}
        

        we need to comment out the test for same timezone, it has a block if code inside the {} so we need to comment out the
        } at the end as well
        change like this

        								// if the timezones are the same, correct date if needed
        								//if (event.start.tz === moment.tz.guess()) {  <---- this line
        									// if the date hour is less than the offset
        									if (24 - dh <= Math.abs(dateoffset / 60)) {
        										// apply the correction to the date/time back to right day
        										date = new Date(date.getTime() + Math.abs(24 * 60) * 60000);
        										// the duration was calculated way back at the top before we could correct the start time..
        										// fix it for this event entry
        										//duration = 24 * 60 * 60 * 1000;
        										Log.debug("new recurring date2 is " + date);
        									}
        								//}   <- --- this line
        

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        F 1 Reply Last reply Nov 18, 2021, 10:08 PM Reply Quote 0
        • F Offline
          flyedge @sdetweil
          last edited by Nov 18, 2021, 10:08 PM

          @sdetweil okay, I went through and changed my original calendar to make sure all events were in the correct time zone, but I was able to make a test event that was the same as the example. If I am understanding correctly, you want me to add // immediately in front of the “if (event.start…” as well as the second set of brackets at the end, two lines down from the “Log.debug…” line, around about lines 348 and 376?

          I did try this, both with the system time zone in Edmonton, and Vancouver. Both resulted in the event still displaying on the 22nd.
          I may have misunderstood what you were asking though as I am very new to this, and have no previous experience with javascript, aside from what I have been able to learn in the last few weeks setting this up.

          One other aside, I have also noticed that all day events are being displayed correctly ahead of time, as well as day of- however the day after the event is scheduled it will remain, and display as an event scheduled that day. (example event will show in 2 days, 2 days ahead of time, ends in x hours on day of, but also shows ends in x hours 1 day after event was scheduled). Is this related to the same type of timezone issues as the original?

          S 1 Reply Last reply Nov 18, 2021, 10:30 PM Reply Quote 0
          • S Away
            sdetweil @flyedge
            last edited by sdetweil Nov 18, 2021, 10:30 PM Nov 18, 2021, 10:30 PM

            @flyedge there are two instances of the if( and } that need to be commented out (//) right?

            total of 4 lines (2 sets of 2)

            1st one is for all day events
            2nd one is for NOT full day events (which is what your event is , as it has time as well)

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            C 1 Reply Last reply Nov 19, 2021, 1:19 PM Reply Quote 0
            • C Offline
              Coolie1101 @sdetweil
              last edited by sdetweil Nov 19, 2021, 1:20 PM Nov 19, 2021, 1:19 PM

              Hey @sdetweil, I am experiencing the same issue and made the changes as you motioned, but now I am getting an error for the calendar module, and the module is not loaded, if I revert the module loads and work as expected, any ideas?

              Config Change

              } else { 
              								// if the timezones are the same, correct date if needed
              //								if (event.start.tz === moment.tz.guess()) {
              									// if the date hour is less than the offset
              									if (24 - dh < Math.abs(dateoffset / 60)) {
              										// apply the correction to the date/time back to right day
              										date = new Date(date.getTime() + Math.abs(24 * 60) * 60000);
              										// the duration was calculated way back at the top before we could correct the start time..
              										// fix it for this event entry
              										//duration = 24 * 60 * 60 * 1000;
              										Log.debug("new recurring date2 is " + date);
              									}
              //								}
              							}
              						} else {
              							// not full day, but luxon can still screw up the date on the rule processing
              							// we need to correct the date to get back to the right event for
              							if (dateoffset < 0) {
              								// if the date hour is less than the offset
              								if (dh < Math.abs(dateoffset / 60)) {
              									// Reduce the time by the offset:
              									// Apply the correction to the date/time to get it UTC relative
              									date = new Date(date.getTime() - Math.abs(nowOffset) * 60000);
              									// the duration was calculated way back at the top before we could correct the start time..
              									// fix it for this event entry
              									//duration = 24 * 60 * 60 * 1000;
              									Log.debug("new recurring date1 is " + date);
              								}
              							} else {
              								// if the timezones are the same, correct date if needed
              //								if (event.start.tz === moment.tz.guess()) {
              									// if the date hour is less than the offset
              									if (24 - dh < Math.abs(dateoffset / 60)) {
              										// apply the correction to the date/time back to right day
              										date = new Date(date.getTime() + Math.abs(24 * 60) * 60000);
              										// the duration was calculated way back at the top before we could correct the start time..
              										// fix it for this event entry
              										//duration = 24 * 60 * 60 * 1000;
              										Log.debug("new recurring date2 is " + date);
              									}
              //								}
              							}
              						}
              						startDate = moment(date);
              
              S 1 Reply Last reply Nov 19, 2021, 1:21 PM Reply Quote 0
              • S Away
                sdetweil @Coolie1101
                last edited by Nov 19, 2021, 1:21 PM

                @coolie1101 said in Calendar events showing on wrong day.:

                Config Change

                you don’t change config, you are changing the module source code, right?

                4 lines in 1 file

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                C 1 Reply Last reply Nov 19, 2021, 1:25 PM Reply Quote 0
                • C Offline
                  Coolie1101 @sdetweil
                  last edited by Coolie1101 Nov 19, 2021, 1:26 PM Nov 19, 2021, 1:25 PM

                  @sdetweil Yes, \modules\default\calendar\calendarutils.js

                  I forgot to post the event in my previous post, see below.

                  BEGIN:VEVENT
                  DTSTART:20191113T100000Z
                  DTEND:20191113T150000Z
                  DTSTAMP:20211119T124216Z
                  UID:6h0hrr7t2gr6qopi**********@google.com
                  RECURRENCE-ID:20191112T100000Z
                  CREATED:20211026T075843Z
                  DESCRIPTION:
                  LAST-MODIFIED:20211026T080254Z
                  LOCATION:
                  SEQUENCE:1
                  STATUS:CONFIRMED
                  SUMMARY:YARD WASTE
                  TRANSP:OPAQUE
                  END:VEVENT
                  
                  S 2 Replies Last reply Nov 19, 2021, 1:28 PM Reply Quote 0
                  • S Away
                    sdetweil @Coolie1101
                    last edited by sdetweil Nov 19, 2021, 1:36 PM Nov 19, 2021, 1:28 PM

                    @coolie1101 can us show me the messages where u start MM? (after doing the edit)

                    should include stuff like this

                    [18.11.2021 15:15.55.588] [LOG]   Connecting socket for: updatenotification
                    [18.11.2021 15:15.55.588] [LOG]   Connecting socket for: calendar
                    [18.11.2021 15:15.55.588] [LOG]   Starting node helper for: calendar
                    [18.11.2021 15:15.55.588] [LOG]   Connecting socket for: newsfeed
                    [18.11.2021 15:15.55.588] [LOG]   Starting node helper for: newsfeed
                    [18.11.2021 15:15.55.588] [LOG]   Connecting socket for: MMM-Config
                    [18.11.2021 15:15.55.588] [LOG]   Starting module helper: MMM-Config
                    [18.11.2021 15:15.55.588] [LOG]   Sockets connected & modules started ...
                    [18.11.2021 15:15.55.665] [LOG]   Launching application.
                    [18.11.2021 15:15.59.955] [LOG]   Create new calendarfetcher for url: http://localhost:8090/modules/default/calendar/canada.ics - Interval: 300000
                    [18.11.2021 15:15.59.964] [LOG]   Create new newsfetcher for url: https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml - Interval: 300000
                    

                    (if using pm2, stop instance first, pm2 stop all)
                    npm start >somefile.txt

                    then ctrl-c after MM shows cal info (if any, or error)

                    then examine somefile.txt

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    C 1 Reply Last reply Nov 19, 2021, 1:51 PM Reply Quote 0
                    • S Away
                      sdetweil @Coolie1101
                      last edited by sdetweil Nov 19, 2021, 1:41 PM Nov 19, 2021, 1:31 PM

                      @coolie1101 do you have the current version of the vevent? as that one expired in 2019, and has no repeating rule

                      but when I adjusted to this year and nov 21

                      BEGIN:VEVENT
                      DTSTART:20211121T100000Z
                      DTEND:20211121T150000Z
                      DTSTAMP:20211119T124216Z
                      UID:6h0hrr7t2gr6qopifribble@google.com
                      RECURRENCE-ID:20191112T100000Z
                      CREATED:20211026T075843Z
                      DESCRIPTION:
                      LAST-MODIFIED:20211026T080254Z
                      LOCATION:
                      SEQUENCE:1
                      STATUS:CONFIRMED
                      SUMMARY:YARD WASTE
                      TRANSP:OPAQUE
                      END:VEVENT
                      

                      i see the right display

                      [19.11.2021 07:40.05.433] [DEBUG] startDate (local): Sun Nov 21 2021 04:00:00 GMT-0600 (Central Standard Time)
                      [19.11.2021 07:40.05.433] [DEBUG] endDate (local): Sun Nov 21 2021 09:00:00 GMT-0600 (Central Standard Time)
                      

                      as there is no timezone associated with that time. and I am CST

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      C 1 Reply Last reply Nov 19, 2021, 1:47 PM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 6
                      • 7
                      • 1 / 7
                      1 / 7
                      • First post
                        8/66
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy