mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 09:42:21 -04:00
- Added autoTimezone property to the clock
This commit is contained in:
parent
1a97107b2d
commit
c608636b7a
3 changed files with 51 additions and 5 deletions
|
@ -26,6 +26,7 @@ Module.register("clock",{
|
|||
analogShowDate: "top", // options: false, 'top', or 'bottom'
|
||||
secondsColor: "#888888",
|
||||
timezone: null,
|
||||
autoTimezone: false
|
||||
},
|
||||
// Define required scripts.
|
||||
getScripts: function() {
|
||||
|
@ -39,16 +40,31 @@ Module.register("clock",{
|
|||
start: function() {
|
||||
Log.info("Starting module: " + this.name);
|
||||
|
||||
// Schedule update interval.
|
||||
var self = this;
|
||||
setInterval(function() {
|
||||
self.updateDom();
|
||||
}, 1000);
|
||||
if (this.config.autoTimezone) {
|
||||
this.sendSocketNotification("AUTO_TIMEZONE");
|
||||
} else {
|
||||
// Schedule update interval.
|
||||
var self = this;
|
||||
setInterval(function() {
|
||||
self.updateDom();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// Set locale.
|
||||
moment.locale(config.language);
|
||||
|
||||
},
|
||||
|
||||
socketNotificationReceived: function (notification, payload) {
|
||||
if (notification === "UPDATE_TIMEZONE") {
|
||||
var self = this;
|
||||
self.config.timezone = payload.timezone;
|
||||
setInterval(function() {
|
||||
self.updateDom();
|
||||
}, 1000);
|
||||
}
|
||||
},
|
||||
|
||||
// Override dom generator.
|
||||
getDom: function() {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue