diff --git a/modules/default/clock/clock.js b/modules/default/clock/clock.js index 3acdf53d..3ab7a248 100644 --- a/modules/default/clock/clock.js +++ b/modules/default/clock/clock.js @@ -48,8 +48,9 @@ Module.register("clock",{ secondsWrapper.className = "dimmed"; // Set content of wrappers. + var format = (this.config.timeFormat === 24) ? "HH:mm" : "hh:mm a"; dateWrapper.innerHTML = moment().format("dddd, LL"); - timeWrapper.innerHTML = moment().format((this.config.timeFormat === 24) ? "HH:mm" : ("hh:mm")); + timeWrapper.innerHTML = moment().format(format); secondsWrapper.innerHTML = moment().format("ss"); // Combine wrappers. diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index c033848f..887270b8 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -201,18 +201,14 @@ Module.register("currentweather",{ var now = moment(); var sunrise = moment(data.sys.sunrise * 1000); var sunset = moment(data.sys.sunset * 1000); + var format = (this.config.timeFormat === 24) ? "HH:mm" : "hh:mm a"; if (sunrise < now && sunset > now) { - if (sunrise.isValid()) { - this.sunriseSunsetTime = sunset.format((this.config.timeFormat === 24) ? "HH:mm" : "hh:mm a"); - } + this.sunriseSunsetTime = sunset.format(format); this.sunriseSunsetIcon = "wi-sunset"; } else { - if (sunset.isValid()) { - this.sunriseSunsetTime = sunrise.format((this.config.timeFormat === 24) ? "HH:mm" : "hh:mm a"); - } + this.sunriseSunsetTime = sunrise.format(format); this.sunriseSunsetIcon = "wi-sunrise"; - } this.loaded = true;