mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 03:39:55 +00:00
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:
parent
77c9c5d006
commit
92032c572a
@ -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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user