Update weather.js

The sunset icon was never displayed because the if statement was different. The sunset and sunrise were are in HH:MM and now in another timestamp.
_sunset > now should be _sunset > _now
This commit is contained in:
LithiumNL 2015-11-01 18:27:21 +01:00
parent 77c9c5d006
commit 92032c572a

View File

@ -84,14 +84,14 @@ weather.updateCurrentWeather = function () {
$(this.temperatureLocation).updateWithText(_newTempHtml, this.fadeInterval); $(this.temperatureLocation).updateWithText(_newTempHtml, this.fadeInterval);
var _now = moment(), var _now = moment().format('HH:mm'),
_sunrise = moment(data.sys.sunrise*1000).format('HH:mm'), _sunrise = moment(data.sys.sunrise*1000).format('HH:mm'),
_sunset = moment(data.sys.sunset*1000).format('HH:mm'); _sunset = moment(data.sys.sunset*1000).format('HH:mm');
var _newWindHtml = '<span class="wi wi-strong-wind xdimmed"></span> ' + this.kmh2Beaufort(_wind), var _newWindHtml = '<span class="wi wi-strong-wind xdimmed"></span> ' + this.kmh2Beaufort(_wind),
_newSunHtml = '<span class="wi wi-sunrise xdimmed"></span> ' + _sunrise; _newSunHtml = '<span class="wi wi-sunrise xdimmed"></span> ' + _sunrise;
if (_sunrise < _now && _sunset > now) { if (_sunrise < _now && _sunset > _now) {
_newSunHtml = '<span class="wi wi-sunset xdimmed"></span> ' + _sunset; _newSunHtml = '<span class="wi wi-sunset xdimmed"></span> ' + _sunset;
} }
@ -165,4 +165,4 @@ weather.init = function () {
this.updateWeatherForecast(); this.updateWeatherForecast();
}.bind(this), this.updateInterval); }.bind(this), this.updateInterval);
} }