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 + + 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"); 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: } - 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;