MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    UNSOLVED module calendar showing full day events one day to long

    Troubleshooting
    5
    19
    4157
    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.
    • A
      AnduriI last edited by

      Hi,

      I use the standard calendar module and it works to my expactations. Only one thing is strange: when I enter a full day event in my google calendar, no matter if 1 day or multiple days, it will be displayed to be on day longer on the MagicMirror.
      So a full day event for today (12th october) would be display for today and tomorrow (12th to 13th october). Does anyone know why?

      Regards,
      Anduril

      ? lavolp3 2 Replies Last reply Reply Quote 0
      • ?
        A Former User @AnduriI last edited by

        @andurii
        I’m not sure, but different timezone setting between your mirrors and Google calendar could cause that kind.

        1 Reply Last reply Reply Quote 0
        • A
          AnduriI last edited by

          I just checked, my google account is set to timezone Berlin and my raspberry is too (set in raspi-config). Is there an additional setting for the magicmirror?

          1 Reply Last reply Reply Quote 0
          • N
            Nilnik Project Sponsor last edited by

            Hello! Check this link: https://forum.magicmirror.builders/topic/8856/calendar-module-1-day-error/3

            1 Reply Last reply Reply Quote 1
            • S
              StrIIker last edited by

              Per @Nilnik 's comment, have a look at that thread. I was having the same issue as well (that’s the thread I had started). Ultimately, it came down to adding the showEnd: false, to the config for the calendar.

              timeFormat: 'absolute',
              showEnd: false,
              
              1 Reply Last reply Reply Quote 0
              • A
                AnduriI last edited by

                thanks for your comments @Nilnik @StrIIker
                This solves the problem, but that’s not a solution 🙂
                It’s more a kind of a hack to hide the problem. I use it to show my daily apointments inclunding multiday ones. Having the mirror show only e.g. my holiday started 5 days ago without a duration is kind of useless.
                As I’m not the only one having that, did anyone ever looked into deeply? Where does this start? Is it a problem with timezones incorrectly submitted by google calendar? Is it a problem of fetching in MM?
                If anyone has a guess, I would greatly appreciate any help. When I know where to look, I might also try to search the root of that bug.
                Are there some people using it and where it works correctly? Or is simply no one using this module at all (without that hack)?

                lavolp3 1 Reply Last reply Reply Quote 0
                • lavolp3
                  lavolp3 Module Developer @AnduriI last edited by

                  @andurii Without looking close on it, I could imagine it’s a matter of timestamps being interpreted by the moment() function.
                  If a full date event creates two timestamps that translate to “Today 0:00:000 - Tomorrow 0:00:000” then it would include tomorrow in the MM translation.
                  However, I’m not sure about this. Will check into it as well. Interesting topic.

                  And you’re right, showEnd: false is not more than a workaround.

                  How to troubleshoot modules
                  MMM-soccer v2, MMM-AVStock

                  1 Reply Last reply Reply Quote 0
                  • lavolp3
                    lavolp3 Module Developer last edited by

                    Here’s the relevant code:

                    					} else {
                    						/* Check to see if the user displays absolute or relative dates with their events
                    						* Also check to see if an event is happening within an 'urgency' time frameElement
                    						* For example, if the user set an .urgency of 7 days, those events that fall within that
                    						* time frame will be displayed with 'in xxx' time format or moment.fromNow()
                    						*
                    						* Note: this needs to be put in its own function, as the whole thing repeats again verbatim
                    						*/
                    						if (this.config.timeFormat === "absolute") {
                    							if ((this.config.urgency > 1) && (event.startDate - now < (this.config.urgency * oneDay))) {
                    								// This event falls within the config.urgency period that the user has set
                    								timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
                    							} else {
                    								timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").format(this.config.fullDayEventDateFormat));
                    							}
                    						} else {
                    							timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
                    						}
                    					}
                    					if(this.config.showEnd){
                    						timeWrapper.innerHTML += "-" ;
                    						timeWrapper.innerHTML += this.capFirst(moment(event.endDate  , "x").format(this.config.fullDayEventDateFormat));
                    					}
                    
                    

                    You can see in the end, that an end to the date is created if showEnd is true. So as far as I can see it, it all comes down to what

                    event.endDate
                    

                    generates.

                    How to troubleshoot modules
                    MMM-soccer v2, MMM-AVStock

                    1 Reply Last reply Reply Quote 0
                    • S
                      StrIIker last edited by

                      @AnduriI I agree that this is a kludge to get the calendar working. I had tried out MMM-MyCalendar which didn’t appear to have this issue (all day events like holidays and birthdays displayed the correct date). It’s a great module BUT, I decided not to use it because I can’t change the colors of the calendars and I could not use a custom icon for different calendars. For example, on my calendar, I have three calendars (US Holidays - white, Birthday calendar - purple with cake icon, and appointments - green). It helps to highlight the different events showing up in the list. I didn’t reach out to the module developer to request this yet. Give it a look, it might be what you are looking for.

                      Unfortunately Magic Mirror has issues which need a kludge hack to resolve (I need to cron a restart of the Magic Mirror application every 5 hours otherwise it goes black (not a screen saver or power saving thing). This has been present for since at least the previous build. Still, I love the Magic Mirror platform and the community is amazing! I am grateful every time I come here and see people helping each other out…

                      lavolp3 1 Reply Last reply Reply Quote 0
                      • lavolp3
                        lavolp3 Module Developer last edited by lavolp3

                        Well this MAY be it. calendarfetcher.js

                        					if (typeof event.end !== "undefined") {
                        						endDate = eventDate(event, "end");
                        					} else if(typeof event.duration !== "undefined") {
                        						dur=moment.duration(event.duration);
                        						endDate = startDate.clone().add(dur);
                        
                        

                        if duration is EXACTLY 24h for a full day event, we would land up at the next day with this .add-function
                        You COULD try the following:

                        Go into calendarfetcher.js and change in line 96

                        endDate = startDate.clone().add(dur);
                        

                        to something like

                        endDate = startDate.clone().add(dur-10000);
                        

                        I can’t do it, I’m at work and REALLY need to go back to it now 🙂

                        EDIT: …well, I needed to try. That’s not the solution. But it should be somewhere in that file 🙂

                        How to troubleshoot modules
                        MMM-soccer v2, MMM-AVStock

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy