MagicMirror Forum

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

    MMM-CalendarExt3

    Utilities
    36
    240
    64817
    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.
    • M
      MMRIZE last edited by MMRIZE

      MMM-CalendarExt3

      New MagicMirror module for calendar view. (successor of MMM-CalendarExt2)

      Screenshot

      screenshot

      Concept

      My previous module, MMM-CalendarExt2, was always notorious for its difficulty to use. I need a more easy and light one. So I rewrite this from scratch newly.

      Features

      What’s different with CX2.

      • Only focusing on how it shows; Parsing is delegated to original MagicMirror module calendar. (It means the calendar module is REQUIRED to use this module.)
      • Only week and month views. I found that people are rarely interested in other views on CX2. So I drop out different views.
      • Respect to original MM’s hide/show mechanism. Now you can hide/show this module easily with other scheduler or control modules. (By the way, Look at this module also. - MMM-Scenes)
      • No dependency on the 3rd party modules (e.g. momentJS or Luxon, etc.). This is built with pure JS and CSS only.

      Main Features

      • week view or month view
      • locale-aware calendar
      • customizing events: filtering, sorting, transforming
      • multi-instance available. You don’t need to copy and rename the module. Just add one more configuration in your config.js.

      DETAILS : https://github.com/MMRIZE/MMM-CalendarExt3

      L BKeyport D B 4 Replies Last reply Reply Quote 2
      • L
        luisestrada @MMRIZE last edited by

        @MMRIZE It took me a while to understand how to show the calendar module without the events module, it was just by not adding the position and worked like a charm 🙂

        Thank you :), great module

        L 1 Reply Last reply Reply Quote 0
        • H
          hrmax last edited by

          Great work @MMRIZE ! I like how this calendar looks much better.

          I am having an issue with the eventTransformer though. I can’t seem to get it to update any of the event properties.

          Is it possible to use the same symbols/icons as set in the calendar module?

          H 1 Reply Last reply Reply Quote 0
          • H
            hrmax @hrmax last edited by

            {
               module: "MMM-CalendarExt3",
               position: "bottom_center",
               title: "",
               config: {
                 mode: "month",
                 instanceId: "basicCalendar",
                 minimalDaysOfNewYear: 1,
                 maxEventLines: 5,
                 firstDayOfWeek: 0,
                 eventFilter: (ev) => {
                   if (ev.title.isFullday) return false
                   return true
                 },
                 eventTransformer: (ev) => {
                     if (ev.title.search('a') > -1)  ev.title = 'test'
                     return event
                 },
            }
            
            M 1 Reply Last reply Reply Quote 0
            • M
              MMRIZE @hrmax last edited by MMRIZE

              @hrmax
              First, Thanks for the feedback. I found there was some mistype in code. I fixed it, so update with git pull.

              Second, for eventFilter

              eventFilter: (ev) => {
                if (ev.isFullday) return false
                return true
              },
              

              Third, for eventTransformer and symbol example.

              eventTransformer: (ev) => {
                ev.title = `<i class="fa fa-${ev.symbol}"></i>${ev.title}`
                return ev
              },
              

              Result;
              4f66a6de-633f-4cca-a921-1c0ce47e23b5-image.png

              H 1 Reply Last reply Reply Quote 0
              • H
                hrmax @MMRIZE last edited by

                @MMRIZE This was super helpful, thank you! It resolved the issues I was having.

                I ended up modifying MMM-CalendarExt3.js so that I could better control the time format. Since I’m using this in portrait mode, I don’t much space so for time values I wanted

                4:00 PM -> 4
                5:30 PM -> 5:30
                
                M 1 Reply Last reply Reply Quote 0
                • M
                  MMRIZE @hrmax last edited by

                  @hrmax

                  You can adjust eventTimeOptions to format the time or date of the event.
                  But not by condition.

                  eventTimeOptions: {
                    hour: "numeric",
                  }
                  

                  will show only hour like 4

                  or

                  eventTimeOptions: {
                    hour: "numeric",
                    minute : "2-digit"
                  }
                  

                  will show the hour and minute like 4:05

                  or

                  eventTimeOptions: {
                    timeStyle: "short"
                  }
                  

                  will show standard locale format like 4:05 am. (It depends on which locale is applied.)

                  But not conditionally. (4 or 4:05 by condition)

                  One possible idea is;
                  Hide the real time parts with CSS, then transform event title to include time;

                  /* In your custom.css */
                  .CX3 .myTime {
                    font-size: 80%;
                    color: #999;
                    font-weight: normal;
                  }
                  
                  .CX3 .event:not(.fullday) .eventTime {
                    display: none;
                  }
                  
                  /* In your config */
                  eventTransformer: (ev) => {
                    if (!ev.isFullday) {
                      let t = new Date(ev.startDate)
                      let time = (t.getMinutes() === 0) ? String(t.getHours()) : String(t.getHours() + ':' + t.getMinutes())
                      ev.title = `<span class="myTime">${time}</span> ${ev.title}`	
                    }
                    return ev 
                  }
                  

                  The result will be;

                  3f2e6599-cf2b-4c94-a064-3704e4ad72bd-image.png

                  H 1 Reply Last reply Reply Quote 0
                  • H
                    hrmax23 @MMRIZE last edited by

                    @MMRIZE

                    This is a much more elegant solution than what I came up with. Many thanks!

                    1 Reply Last reply Reply Quote 0
                    • Assassins
                      Assassins last edited by

                      Will it be possible to pull out the birthday that is associated with a contact person from icloud. ???

                      M 1 Reply Last reply Reply Quote 0
                      • L
                        luisestrada @luisestrada last edited by

                        @MMRIZE , just a note. I also use the browser to open the mirror and works in all platforms I’ve tested except one, Tizen browser (Samsung TVs). All modules work but this, no idea what happens but probably any form of javascript may not be supported by Tizen.

                        I’m quite happy with the module though

                        M 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 5
                        • 23
                        • 24
                        • 1 / 24
                        • 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