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.

    MMM-CustomElementTime

    Scheduled Pinned Locked Moved Utilities
    6 Posts 3 Posters 968 Views 3 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.
    • S Do not disturb
      sdetweil @MMRIZE
      last edited by

      @mmrize angular has had support for custom tags for a long time.

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      M 1 Reply Last reply Reply Quote 0
      • M Offline
        MMRIZE @sdetweil
        last edited by

        @sdetweil right. Anyway we will not rewrite mm with angular or vue. :) (I prefer vue)

        cowboysdudeC 1 Reply Last reply Reply Quote 0
        • cowboysdudeC Offline
          cowboysdude Module Developer @MMRIZE
          last edited by

          @mmrize if you’re talking about time you can just do that with straight ol vanilla js …

                    var DateDiff = {
                          inDays: function(d1, d2) {
                              var t2 = d2.getTime();
                              var t1 = d1.getTime();
                            return parseInt((t2 - t1) / (24 * 3600 * 1000));
                          },
                      }
          

          I use that in my upcoming Holiday module to get days left until a particular holiday

          holiday.png

          If you’re looking for days left kind of thing. I know you can do this for other time variables such as minutes, seconds, etc.

          S M 2 Replies Last reply Reply Quote 0
          • S Do not disturb
            sdetweil @cowboysdude
            last edited by

            @cowboysdude he is proposing a new html tag that will produce the content in a consistent way with the new time apis(not moment), so only have to write it once, and everybody benefits

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 1
            • M Offline
              MMRIZE @cowboysdude
              last edited by

              @cowboysdude
              Yup, Every developer can implement his own logic to display time-related stuff. And hundreds of MM modules are there, so hundreds of implementations are existing also, just to display “in 15 days”.
              I think it is a kind of waste. So I propose a reusable common HTML tag anyone can use anywhere.

              But the most benefit of this custom tag is, in my thought, Customizability and Locale-awareness separated from the module itself. Logic-neutral HTML tag could give the ability of easier user-customization without the developer’s effort. That is the purpose of this custom tag.

              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