Skip to content

Magic Mirror module that can show time remaining or time passed from a given date and time.

License

Notifications You must be signed in to change notification settings

alltopafi/MMM-DateCounter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MMM-DateCounter

Display a countdown or count up to a specfic date.

Screenshots

Long format with icon

Long format with icon

Long format without hours, minutes, or seconds

Long format without hours, minutes, or seconds

Default moment fromNow no icon

Default moment fromNow no icon

Default momenent fromNow with icon

Default momenent fromNow with icon

Regular installation

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.

Configuration

{
    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
    }
}

Usage

updateInterval

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.

Default:

updateInterval: 1000,

updateInterval

You can point to a remote config file instead of a local file.

Default:

remoteFile: null,

eventDate

The ISO 8601 date (YYYY-MM-dd) of the event you are counting to/from/

Default:

eventDate: "2020-07-15",

eventStartTime

The time (h:mm:-ss) that you the event starts/occurs.

Default:

eventStartTime: "0:00",

eventTitle

The title to be displayed above the counter.

Default:

eventTitle: "Happy Birthday!",

showLongCountdown

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.

Default:

showLongCountdown: true,

longCountdownFormat

List of units that you would like incuded in the longCountdown if applicable. Allowed values include year, month, week, day, hour, minute, second.

Default:

longCountdownFormat: "year,month,week,day,hour,minute,second",

longCountdownAutoSize

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.

Default:

longCountdownAutoSize: true,

icon

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.

Default:

icon: null,

hideOnExpiration

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.

Deffault:

hideOnExpiration: false

'showOnOneLine'

If you would like the formatted text to be displayed on a single line set to true.

Default:

showOnOneLine: false

About

Magic Mirror module that can show time remaining or time passed from a given date and time.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published