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

Default Calendar // Multiple caldendar instances overwritting each other..(maximumNumberOfDays)



  • Hi there,

    I don’t exactly what I’m doing wrong or if the issue comes from the module itself.

    My issue :

    I’m running 3 instances of the default calendar.
    In some case, the 3 calendars instances are pointing to the same calendars URL, nevertheless, I want the 3 instances to have a different “maximumNumberOfDays” config.

    The “maximumNumberOfDays” of instance 1 is overwritten by the 2 second instance settings, and so on…Making my wish to have different setups impossible as all the 3 instances are using same “maximumNumberOfDays”.

    You will find my code hereunder, help would be highly appreciated!!

    		{
    			disabled: false,
    			module: "calendar",
    			header: "Aujourd'hui",
    			position: "top_left",
    			config: {
    				timeFormat: "absolute",
    				maximumNumberOfDays: 1,
    				excludedEvents: [],
    				calendars: [
    					{       
    						// Anniversaires
    						symbol: "birthday-cake",
    						url: "https://1.ics",
    						maximumNumberOfDays: 1
    					},
    					{
    						// Calendrier Fabrice
    						symbol: "calendar-check",
    						url: "https://2.ics",
    						maximumNumberOfDays: 1
    					},
    					{
    						// Calendrier Audrey
    						symbol: "calendar-check-o",
    						url: "https://3.ics",
    						maximumNumberOfDays: 1
    					},
    					{
    						// Calendrier Férié
    						symbol: "flag",
    						url: "https://4.ics",
    						maximumNumberOfDays: 1
    					},
    					{
    						// Vacances Scolaires
    						symbol: "sun",
    						url: "http://www.5.ics",
    						maximumNumberOfDays: 1
    					},
    					{
    						// Repas
    						symbol: "utensils",
    						url: "https://6.ics",
    						maximumNumberOfDays: 1
    					}
    				],
    			}
    		},
    		{
    			disabled: true,
    			module: "calendar",
    			header: "Demain",
    			position: "top_left",
    			config: {
    				timeFormat: "absolute",
    				maximumNumberOfDays: 2,
    				excludedEvents: [],
    				calendars: [
    					{
    						// Anniversaires
    						symbol: "birthday-cake",
    						url: "https://1.ics",
    						maximumNumberOfDays: 2
    					},
    					{
    						// Calendrier Fabrice
    						symbol: "calendar-check",
    						url: "https://2",
    						maximumNumberOfDays: 2
    					},
    					{
    						// Calendrier Audrey
    						symbol: "calendar-check-o",
    						url: "https://3.ics",
    						maximumNumberOfDays: 2
    					},
    					{
    						// Calendrier Férié
    						symbol: "flag",
    						url: "https://4.ics",
    						maximumNumberOfDays: 2
    					},
    					{
    						// Vacances Scolaires
    						symbol: "sun",
    						url: "http://5.ics",
    						maximumNumberOfDays: 2
    					},
    					{
    						// Repas
    						symbol: "utensils",
    						url: "https://6.ics",
    						maximumNumberOfDays: 2	
    					}
    				],
    			}
    		},
    		{
    			disabled: false,
    			module: "calendar",
    			header: "Evénements à venir",
    			position: "top_left",
    			config: {
    				timeFormat: "absolute",
    				maximumNumberOfDays: 62,
    				excludedEvents: ["Poney"],
    				calendars: [
    					{
    						// Anniversaires
    						symbol: "birthday-cake",
    						url: "https://1.ics",
    						//maximumNumberOfDays: 62
    					},
    					{
    						// Calendrier Fabrice
    						symbol: "calendar-check",
    						url: "https://2.ics",
    						//maximumNumberOfDays: 62
    					},
    					{
    						// Calendrier Audrey
    						symbol: "calendar-check-o",
    						url: "https://3.ics",
    						//maximumNumberOfDays: 62
    					},
    					{
    						// Calendrier Férié
    						symbol: "flag",
    						url: "https://4.ics",
    						//maximumNumberOfDays: 62
    					},
    					{
    						// Vacances Scolaires
    						symbol: "sun",
    						url: "http://5.ics",
    						//maximumNumberOfDays: 62
    					}
    				],
    			}
    		},
    

    NOTE : it seems that the issue was already pointed out on Github, and MichMich even stating that this could be easy to solve, but I clearly have no clue how…
    GitHub Issue #1109

    Anyway, really hope someone could support my need…

    Thanks in advance



  • well… I believe it’s far from being perfect…but at least it seems to do the job…

    I created a “new” module which does exactly same / has the same code as the one I want to use, but has a different name (folder named “MMM-Calendar2” -> file named “MMM-Calendar2.js” -> within the line Module.register(‘MMM_Calendar2’)).
    Not in the default module folder but into the 3rd party module folder…



  • @bolish did u change something from the original?



  • no… just copy paste, renaming.



  • @bolish so, are you running BOTH calender modules, default and your ‘new’ one?



  • yes indeed.



  • Some additional Information:

    In calendarfetcher.js and nodehelper.js is the following line:

    const Log = require("../../../js/logger.js");
    

    If you copy the “calendar” folder down to “modules” this reference will be broken.
    So you have to change to:

    const Log = require("../../js/logger.js");
    

Log in to reply