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