date mask in clock module?



  • 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?



  • 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/


  • Module Developer

    @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.