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

Text per week

  • Project Sponsor Module Developer

    Does anyone know if there is a module that let’s you show a different text each week? My son is learning letters in school and each week they have a certain letter, like this:

    week 38: R
    week 39: E
    week 40: P

    My though was to show this week’s letter on my mirror.

  • Module Developer

    As far as I know, there is nothing like that. 😃
    But I think it could be easily developed.
    with moment.js library, you can easily get the order of the current week.

    const letterOfWeek = ["", "", "A", ... "R", "E", "P", ...],
    var curWeekNumber = moment().week() //will return 1~52. You can use `isoWeek()` also.
    var letterOfThisWeek = letterOfWeek[curWeekNumber]

    This is just an idea, anyway, I believe you can make a simple module to display this.

  • Module Developer

    Here. not fully tested.

      defaults: {
        letterOfWeek: {
          "default": "?",
          "38": "A",
          "39": "B",
          "40": "C",
        updateInterval: 1000*60*60*3, // refresh per 3 hour.
      getScripts: function() {
        return ["moment.js"]
      getStyles: function() {
        return ["letterOfWeek.css"] // You need to parepare your own css.
      getDom: function() {
        var getLetter = ()=> {
          var thisWeek = moment().week()
          var letter = (this.config.letterOfWeek.hasOwnProperty(thisWeek))
            ? this.config.letterOfWeek[thisWeek]
            : this.config.letterOfWeek["default"]
          return letter
        var dom = document.createElement("div")
        dom.innerHTML = getLetter()
        return dom
      notificationReceived: function(noti, payload) {
        if (noti == "DOM_OBJECTS_CREATED") {
      refresh: function() {
        }, this.config.updateInterval)

  • Project Sponsor Module Developer

    @Sean Thanks a lot! My thought was to make a module, but wanted to check first if one existed. And now you did the work for me 🙂 I will try it out tonight. Maybe even upload it so others can download it.

  • Project Sponsor Module Developer

    So a lot later I finally managed to make a module out of this:

    Thanks again @Sean !

Log in to reply