From b4df63f37f5682739f36a3f48e64e13eea857cda Mon Sep 17 00:00:00 2001 From: Cody Date: Mon, 18 Apr 2016 19:53:34 -0400 Subject: [PATCH] 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;