Display a countdown or count up to a specfic date.
Open a terminal session, navigate to your MagicMirror's modules folder and execute git clone https://github.com/alltopafi/MMM-DateCounter.git, a new folder called MMM-DateCounter will be created.
Activate the module by adding it to the config.js file as shown below.
{
module: "MMM-DateCounter",
position: "top_left",
config: {
updateInterval: 1000,
remoteFile: null,
eventDate: "2020-07-15",
eventStartTime: "0:00",
eventTitle: "Happy Birthday!",
showLongCountdown: true,
longCountdownFormat: "year,month,week,day,hour,minute,second",
longCountdownAutoSize: true,
icon: "/modules/MMM-DateCounter/birthday_cake.svg",
hideOnExpiration: false,
showOnOneLine, false
}
}
How often the the module will update the countdown. Tip: If you using longCountdown set this to whatever your smallest unit is ie if including seconds set to 1000, if using minute as smallest unit use 60000.
updateInterval: 1000,
You can point to a remote config file instead of a local file.
remoteFile: null,
The ISO 8601 date (YYYY-MM-dd) of the event you are counting to/from/
eventDate: "2020-07-15",
The time (h:mm:-ss) that you the event starts/occurs.
eventStartTime: "0:00",
The title to be displayed above the counter.
eventTitle: "Happy Birthday!",
You can either use the default message from moment.js fromNow or a long countdown that will show a long format of any units included in longCountdownFormat that are applicable. ie If the event is 10 months away it would not show years.
showLongCountdown: true,
List of units that you would like incuded in the longCountdown if applicable. Allowed values include year, month, week, day, hour, minute, second.
longCountdownFormat: "year,month,week,day,hour,minute,second",
If this is enabled the font size will get larger as units fall off. ie When the countdown crosses from 1 month to 4 weeks, month will no longer be displayed and the font size will incrase to compensate for the new amount of space.
longCountdownAutoSize: true,
You may include an image to show next to the countdown, this can be a local image (/modules/MMM-DateCounter/Flat_tick_icon.svg") (recommend adding to the root folder if this module), or you can use an image hosted on online. (https://upload.wikimedia.org/wikipedia/commons/7/73/Flat_tick_icon.sv). The module will automatically resize and place the image on the right side of the module.
icon: null,
If you would like the module to be hidden after the date has passed set to true. Note: If the module is hidden it should not be doing any processing.
hideOnExpiration: false
If you would like the formatted text to be displayed on a single line set to true.
showOnOneLine: false