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.

    How to correctly configure the calendar module

    Scheduled Pinned Locked Moved Solved Troubleshooting
    5 Posts 2 Posters 1.5k Views 2 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.
    • Feedy88F Offline
      Feedy88
      last edited by

      I am trying to cofigure the calendar module in the following way but cannot make it happen so maybe someone can help me out:

      • For today’s all day events, display Today
      • For today’s event with a certain time, display Today, 9:00
      • For tomororw’s all day events, display Tomorrow
      • For tomorrow’s event with a certain time, display Tomorrow, 9:00
      • For all other later events, display the date respectively date and time if not all-day event.

      This is what my current config looks like:

      module: "calendar",
      header: "Termine & Feiertage",
      position: "top_left",
      config: {
        fetchInterval: 300000, //5 Minute
        displaySymbol: true,
        showLocation: false,
        fade: true,
        fadePoint: 0.4,
        dateFormat: "D. MMM HH:mm",
        fullDayEventDateFormat: "D. MMM",
        timeFormat: "absolute",
        getRelative: 12,
        urgency: 0,
        maximumEntries: 10,
        displayRepeatingCountTitle: true,
        hideOngoing: false,
        nextDaysRelative: true,
        calendars: 
        	...
      	]
      }
      

      I have added nextDaysRelative: true as a temp solution to get the next day relative and know this should probably be removed.

      Any help would be appreciated.

      S 2 Replies Last reply Reply Quote 0
      • S Offline
        sdetweil @Feedy88
        last edited by

        @Feedy88 the code only does today/tomorrow/… for full day events, not with time.

        and nextDaysRelative: true is required for full day events to show

        					if (event.fullDayEvent && this.config.nextDaysRelative) {
        						// Full days events within the next two days
        						if (event.today) {
        							timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("TODAY"));
        						} else if (event.yesterday) {
        							timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("YESTERDAY"));
        						} else if (event.startDate - now < ONE_DAY && event.startDate - now > 0) {
        							timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("TOMORROW"));
        						} else if (event.startDate - now < 2 * ONE_DAY && event.startDate - now > 0) {
        							if (this.translate("DAYAFTERTOMORROW") !== "DAYAFTERTOMORROW") {
        								timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("DAYAFTERTOMORROW"));
        							}
        						}
        					}
        

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        Feedy88F 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @Feedy88
          last edited by

          @Feedy88 please don’t post in discord and the forums… pick one

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @Feedy88
            last edited by

            @Feedy88 the code only does today/tomorrow/… for full day events, not with time.

            and nextDaysRelative: true is required for full day events to show

            					if (event.fullDayEvent && this.config.nextDaysRelative) {
            						// Full days events within the next two days
            						if (event.today) {
            							timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("TODAY"));
            						} else if (event.yesterday) {
            							timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("YESTERDAY"));
            						} else if (event.startDate - now < ONE_DAY && event.startDate - now > 0) {
            							timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("TOMORROW"));
            						} else if (event.startDate - now < 2 * ONE_DAY && event.startDate - now > 0) {
            							if (this.translate("DAYAFTERTOMORROW") !== "DAYAFTERTOMORROW") {
            								timeWrapper.innerHTML = CalendarUtils.capFirst(this.translate("DAYAFTERTOMORROW"));
            							}
            						}
            					}
            

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            Feedy88F 1 Reply Last reply Reply Quote 0
            • Feedy88F Offline
              Feedy88 @sdetweil
              last edited by

              @sdetweil Acknowledged to only post in one medium, sorry for that.

              Thanks a lot for the code. Can you tell me where this has to be added?

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                sdetweil @Feedy88
                last edited by sdetweil

                @Feedy88 that is the existing code. only for fullDayEvent.

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  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