mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Allow 12 hour period config
Allow for configuring the 12 hour format period (AM/PM).
This commit is contained in:
parent
3892ce3ed4
commit
16a7ea2b75
@ -13,6 +13,8 @@ Module.register("clock",{
|
|||||||
defaults: {
|
defaults: {
|
||||||
timeFormat: config.timeFormat,
|
timeFormat: config.timeFormat,
|
||||||
displaySeconds: true,
|
displaySeconds: true,
|
||||||
|
showPeriod: true,
|
||||||
|
showPeriodUpper: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
// Define required scripts.
|
// Define required scripts.
|
||||||
@ -55,7 +57,15 @@ 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;
|
||||||
timeString = hours + moment().format(':mm a');
|
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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dateWrapper.innerHTML = moment().format("dddd, LL");
|
dateWrapper.innerHTML = moment().format("dddd, LL");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user