From 16a7ea2b75892ea1e55d498dc9e43fe3eae7bb25 Mon Sep 17 00:00:00 2001 From: Cody Date: Mon, 18 Apr 2016 19:52:40 -0400 Subject: [PATCH] Allow 12 hour period config Allow for configuring the 12 hour format period (AM/PM). --- modules/default/clock/clock.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/default/clock/clock.js b/modules/default/clock/clock.js index 09b30da5..cdae1db3 100644 --- a/modules/default/clock/clock.js +++ b/modules/default/clock/clock.js @@ -13,6 +13,8 @@ Module.register("clock",{ defaults: { timeFormat: config.timeFormat, displaySeconds: true, + showPeriod: true, + showPeriodUpper: false, }, // Define required scripts. @@ -55,7 +57,15 @@ Module.register("clock",{ if (this.config.timeFormat !== 24) { var now = new Date(); 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");