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.

    date mask in clock module?

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 3 Posters 2.4k 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.
    • C Offline
      ChrisJScott
      last edited by ChrisJScott

      First off, ‘hi everybody!’ New user, just spent a good chunk of the night setting up my first Raspberry Pi and installing MM2; loving it!

      I’ve made good progress getting things set up and a question has come up (and I’m sure this is the wrong place t post but, frankly, github confuses the hell out of me):

      re. the clock module, it would be great to be able to tweak the format of the date using standard masking a la PHP (http://php.net/manual/en/function.date.php).

      Anybody given any though to that?

      1 Reply Last reply Reply Quote 0
      • strawberry 3.141S Offline
        strawberry 3.141 Project Sponsor Module Developer
        last edited by

        you can modify clock.js for your needs, but changes will get removed with an update

        https://github.com/MichMich/MagicMirror/blob/master/modules/default/clock/clock.js#L71 starting with this line you can change moment().format() and specify the format you want all possibilities are listed here http://momentjs.com/docs/#/displaying/format/

        Please create a github issue if you need help, so I can keep track

        1 Reply Last reply Reply Quote 0
        • yo-lessY Offline
          yo-less Module Developer
          last edited by yo-less

          @strawberry-3-141 is right, but if you generally like the clock module the way it is and just don’t like the way the date is being displayed, you can simply change it as has been pointed out and add

          /modules/default/clock/clock.js
          

          to the end of the file .gitignore you can find in the MagicMirror main folder (for example by using sudo nano .gitignore).

          Not sure, if you’re new to the Linux environment as well, you won’t see the file using the dir command, as the dot at the beginning makes it a hidden file. Anything you add to .gitignore will not be updated when you perform a git pull, so be careful with adding files to the list, as you may break your installation when some parts of the mirror get updated but others don’t. I wouldn’t worry about adding the clock module, though.

          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