From 16a7ea2b75892ea1e55d498dc9e43fe3eae7bb25 Mon Sep 17 00:00:00 2001 From: Cody Date: Mon, 18 Apr 2016 19:52:40 -0400 Subject: [PATCH 1/4] 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"); From b4df63f37f5682739f36a3f48e64e13eea857cda Mon Sep 17 00:00:00 2001 From: Cody Date: Mon, 18 Apr 2016 19:53:34 -0400 Subject: [PATCH 2/4] Allow 12 hour period config Allow for configuring the 12 hour format period (AM/PM). --- modules/default/currentweather/currentweather.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index 242bbe8e..3a7520ce 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -17,6 +17,8 @@ Module.register("currentweather",{ updateInterval: 10 * 60 * 1000, // every 10 minutes animationSpeed: 1000, timeFormat: config.timeFormat, + showPeriod: true, + showPeriodUpper: false, lang: config.language, initialLoadDelay: 0, // 0 seconds delay @@ -209,7 +211,15 @@ Module.register("currentweather",{ var timeString = moment(sunriseSunsetDateObject).format('HH:mm'); if (this.config.timeFormat !== 24) { var hours = sunriseSunsetDateObject.getHours() % 12 || 12; - timeString = hours + moment(sunriseSunsetDateObject).format(':mm a'); + if (this.config.showPeriod) { + if (this.config.showPeriodUpper) { + timeString = hours + moment(sunriseSunsetDateObject).format(':mm A'); + } else { + timeString = hours + moment(sunriseSunsetDateObject).format(':mm a'); + } + } else { + timeString = hours + moment(sunriseSunsetDateObject).format(':mm'); + } } this.sunriseSunsetTime = timeString; From d0e57df1d88acfa6a8ebe62be16df87e11d5f2c1 Mon Sep 17 00:00:00 2001 From: Cody Date: Mon, 18 Apr 2016 20:01:53 -0400 Subject: [PATCH 3/4] Add documentation for 12 hour period config Add the documentation for the 12 hour period config --- modules/default/clock/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/default/clock/README.md b/modules/default/clock/README.md index ab65d3f4..522b1ad2 100644 --- a/modules/default/clock/README.md +++ b/modules/default/clock/README.md @@ -45,5 +45,19 @@ The following properties can be configured:
Default value: true + + showPeriod + Show the period (am/pm) with 12 hour format
+
Possible values: true or false +
Default value: true + + + + showPeriodUpper + Show the period (AM/PM) with 12 hour format as uppercase
+
Possible values: true or false +
Default value: false + + From 54eeb27f0952e14a62dcf427907a45492cfa1e38 Mon Sep 17 00:00:00 2001 From: Cody Date: Mon, 18 Apr 2016 20:03:26 -0400 Subject: [PATCH 4/4] Add documentation for 12 hour period config Add the documentation for the 12 hour period config --- modules/default/currentweather/README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/default/currentweather/README.md b/modules/default/currentweather/README.md index 4a418ad9..3c818eee 100644 --- a/modules/default/currentweather/README.md +++ b/modules/default/currentweather/README.md @@ -76,6 +76,20 @@ The following properties can be configured:
Default value: uses value of config.timeFormat + + showPeriod + Show the period (am/pm) with 12 hour format
+
Possible values: true or false +
Default value: true + + + + showPeriodUpper + Show the period (AM/PM) with 12 hour format as uppercase
+
Possible values: true or false +
Default value: false + + lang The language of the days.
@@ -140,6 +154,5 @@ The following properties can be configured: } -