Read the statement by Michael Teeuw here.
module calendar showing full day events one day to long
-
Hello! Check this link: https://forum.magicmirror.builders/topic/8856/calendar-module-1-day-error/3
-
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,
-
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)? -
@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.
-
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.
-
@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…
-
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 :-)
-
@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.
-
@striiker I guess this forum got too crowded to have everything solved properly. I feel you.