From 44a6604fe8519e01b3f93868a4f75247615c2b67 Mon Sep 17 00:00:00 2001 From: Michael Teeuw Date: Sat, 16 Apr 2016 19:55:19 +0200 Subject: [PATCH] Possible fix for #181 --- modules/default/currentweather/currentweather.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index 103a1d78..120b8bf6 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -203,10 +203,14 @@ Module.register("currentweather",{ var sunset = moment(data.sys.sunset * 1000).format("x"); if (sunrise < now && sunset > now) { - this.sunriseSunsetTime = moment(data.sys.sunset * 1000).format((this.config.timeFormat === 24) ? "HH:mm" : "hh:mm a"); + if (sunrise.isValid()) { + this.sunriseSunsetTime = moment(data.sys.sunset * 1000).format((this.config.timeFormat === 24) ? "HH:mm" : "hh:mm a"); + } this.sunriseSunsetIcon = "wi-sunset"; } else { - this.sunriseSunsetTime = moment(data.sys.sunrise * 1000).format((this.config.timeFormat === 24) ? "HH:mm" : "hh:mm a"); + if (sunset.isValid()) { + this.sunriseSunsetTime = moment(data.sys.sunrise * 1000).format((this.config.timeFormat === 24) ? "HH:mm" : "hh:mm a"); + } this.sunriseSunsetIcon = "wi-sunrise"; }