Change formatting. #181

This commit is contained in:
Michael Teeuw 2016-04-16 21:42:44 +02:00
parent 9c9e93974e
commit 8adb16e1f6
2 changed files with 5 additions and 8 deletions

View File

@ -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.

View File

@ -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;