Possible fix for #181

This commit is contained in:
Michael Teeuw 2016-04-16 19:55:19 +02:00
parent 47a18666b6
commit 44a6604fe8

View File

@ -203,10 +203,14 @@ Module.register("currentweather",{
var sunset = moment(data.sys.sunset * 1000).format("x"); var sunset = moment(data.sys.sunset * 1000).format("x");
if (sunrise < now && sunset > now) { if (sunrise < now && sunset > now) {
if (sunrise.isValid()) {
this.sunriseSunsetTime = moment(data.sys.sunset * 1000).format((this.config.timeFormat === 24) ? "HH:mm" : "hh:mm a"); this.sunriseSunsetTime = moment(data.sys.sunset * 1000).format((this.config.timeFormat === 24) ? "HH:mm" : "hh:mm a");
}
this.sunriseSunsetIcon = "wi-sunset"; this.sunriseSunsetIcon = "wi-sunset";
} else { } else {
if (sunset.isValid()) {
this.sunriseSunsetTime = moment(data.sys.sunrise * 1000).format((this.config.timeFormat === 24) ? "HH:mm" : "hh:mm a"); this.sunriseSunsetTime = moment(data.sys.sunrise * 1000).format((this.config.timeFormat === 24) ? "HH:mm" : "hh:mm a");
}
this.sunriseSunsetIcon = "wi-sunrise"; this.sunriseSunsetIcon = "wi-sunrise";
} }