mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
fix: #206
This commit is contained in:
parent
287452169b
commit
d778f2dd8b
@ -43,6 +43,7 @@ Module.register("clock",{
|
||||
var dateWrapper = document.createElement("div");
|
||||
var timeWrapper = document.createElement("div");
|
||||
var secondsWrapper = document.createElement("sup");
|
||||
var periodWrapper = document.createElement("span");
|
||||
|
||||
// Style Wrappers
|
||||
dateWrapper.className = "date normal medium";
|
||||
@ -57,27 +58,30 @@ Module.register("clock",{
|
||||
if (this.config.timeFormat !== 24) {
|
||||
var now = new Date();
|
||||
var hours = now.getHours() % 12 || 12;
|
||||
if (this.config.showPeriod) {
|
||||
if (this.config.showPeriodUpper) {
|
||||
timeString = hours + moment().format(':mm A');
|
||||
} else {
|
||||
timeString = hours + moment().format(':mm a');
|
||||
}
|
||||
} else {
|
||||
timeString = hours + moment().format(':mm');
|
||||
}
|
||||
timeString = hours + moment().format(':mm');
|
||||
}
|
||||
|
||||
dateWrapper.innerHTML = moment().format("dddd, LL");
|
||||
timeWrapper.innerHTML = timeString;
|
||||
secondsWrapper.innerHTML = moment().format("ss");
|
||||
|
||||
|
||||
if (this.config.showPeriodUpper) {
|
||||
periodWrapper.innerHTML = moment().format('A');
|
||||
} else {
|
||||
periodWrapper.innerHTML = moment().format('a');
|
||||
}
|
||||
|
||||
|
||||
// Combine wrappers.
|
||||
wrapper.appendChild(dateWrapper);
|
||||
wrapper.appendChild(timeWrapper);
|
||||
if (this.config.displaySeconds) {
|
||||
timeWrapper.appendChild(secondsWrapper);
|
||||
}
|
||||
if (this.config.showPeriod) {
|
||||
timeWrapper.appendChild(periodWrapper);
|
||||
}
|
||||
|
||||
// Return the wrapper to the dom.
|
||||
return wrapper;
|
||||
|
Loading…
x
Reference in New Issue
Block a user