MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

module calendar showing full day events one day to long


  • Module Developer

    @striiker
    I need to disagree here.
    MagicMirror does not need kludge hacks!
    It needs development!

    I am 100% sure your 5-hours-restart-hack can be solved without the workaround.



  • @lavolp3 said in module calendar showing full day events one day to long:

    @striiker
    I need to disagree here.
    MagicMirror does not need kludge hacks!
    It needs development!

    I am 100% sure your 5-hours-restart-hack can be solved without the workaround.

    I absolutely agree that it needs development. Unfortunately that’s outside of my realm of expertise (and others who have these types of issues). In the absence of someone actively developing a solution to a defect which should be widely known (I have had this crash happen on multiple fresh, new base installs) we are left with using what we can to work around the issues.

    The only responses I had to my query around the crashing was from others who had this happen and one person who suggested the cron restart. There was another post by someone else with the same issue as well.

    Beggars can’t be choosers and I’m not complaining about this. I am hopeful that these issues will get addressed some day but in the mean time, here we are.


  • Module Developer

    @striiker I guess this forum got too crowded to have everything solved properly. I feel you.


  • Module Developer

    @andurii OK I found a way to properly deal with one-day events. Will send a PR to the develop branch.
    If you want to include it already:

    Exchange the if-clause starting at line 292 with this.

    					if(this.config.showEnd){
    						if(event.endDate - event.startDate > oneDay) { 
    							timeWrapper.innerHTML += "-" ;
    							timeWrapper.innerHTML += this.capFirst(moment(event.endDate  , "x").format(this.config.fullDayEventDateFormat));
    						}
    					}
    

    BEWARE OF CHANGING THE MODULE FILES THEMSELVES.
    Only do it if you know what you’re doing.
    (You’re not breaking anything irreversibly however)

    This only shows the end date for a more-than-one-day-full-day-event.
    However, still a workaround. Still searching into the problem itself



  • @lavolp3 thank’s a lot man, you are much faster and way more skilled than me 🙂
    Just a little discussion: your code only adds the if clause to check if it’s longer than a day to prevent single full day events to be displayed as two day. But what about a multi day event beeing displayed one day to long (which is also happening right now)?


  • Module Developer

    @andurii
    Yeah that’s what is still missing and why i said this is still only some type of workaround.
    However, the if-clause will be needed in the end because for a full one-day event you do not want to be shown an endDate. As soon as the full-day-event is longer than one day, you may want it again.
    E.g.
    Mario’s birthday Nov 16th
    (and NOT Nov 16th - Nov 16th)
    Luigi’s Holiday Nov 16th - Nov 23rd

    What you’re pointing at is the root cause and it lies somewhere else. I’m sure it can be solved. Give me one weekend 😉


  • Module Developer

    So I guess I have found a “solution”.
    This is in fact a systemic problem.

    A full day event is given by the ical source as starting at 0:00 on a day and ending at 0:00, but one day ahead. The duration is exactly a multiple of 24h.

    There is a one-liner as workaround, but I’d invite everyone to find a more gentle solution.

    The workaround: subtract one second from the endDate time:
    Include this line into calendar.js just at the beginning of the if clause in line 262:

    event.endDate -= 1000;
    

    So it looks like this:

    				if (event.fullDayEvent) {
                                            event.endDate -= 1000;
    					if (event.today) {
    

    This should solve the issue. It worked for me at least.



  • @lavolp3 great, your fix worked. Only thing I noticed is if the date is tomorrow it still shows ‘Tomorrow - Nov. 22’
    Now I still have to fiddle a few glitches in the calendar module:

    1. Having a event with start and end time it will be displayed like ‘in 3 days - 18:00’. It would be better to include starting time ‘in 3 days 15:00 - 18:00’
    2. For a ongoing event it keeps the end time, but start time gets relative for how long it still goes on ‘1 hour left - 18:00’ (hope my translation is correct, my mirror is german). Maybe this could be changed to ‘for 4 hours - 18:00’ or similiar.

  • Module Developer

    @andurii I agree with you on both points and I’m working on it 🙂
    Basically the implementation of showEnd is quite messed up.
    I’m trying to use my freshly gained JS beginner skills on this 🙂

    Have send a PR for the fulldayevent fix and I expect this to be included in the next release.


Log in to reply