Fix warning in weather provider

This commit is contained in:
veeck 2021-06-30 16:00:26 +02:00
parent bcc0cc599d
commit bcff953fbb
3 changed files with 7 additions and 5 deletions

View File

@ -359,7 +359,7 @@ WeatherProvider.register("envcanada", {
var lastDate = moment(baseDate, "YYYYMMDDhhmmss");
for (var stepDay = nextDay; stepDay < lastDay; stepDay += 2) {
var weather = new WeatherObject(this.config.units, this.config.tempUnits, this.config.windUnits);
let weather = new WeatherObject(this.config.units, this.config.tempUnits, this.config.windUnits);
// Add 1 to the date to reflect the current forecast day we are building

View File

@ -216,12 +216,12 @@ WeatherProvider.register("smhi", {
*/
fillInGaps(data) {
let result = [];
for (const i = 1; i < data.length; i++) {
for (let i = 1; i < data.length; i++) {
let to = moment(data[i].validTime);
let from = moment(data[i - 1].validTime);
let hours = moment.duration(to.diff(from)).asHours();
// For each hour add a datapoint but change the validTime
for (const j = 0; j < hours; j++) {
for (let j = 0; j < hours; j++) {
let current = Object.assign({}, data[i]);
current.validTime = from.clone().add(j, "hours").toISOString();
result.push(current);

View File

@ -1,3 +1,5 @@
/* global WeatherProvider, WeatherObject, SunCalc */
/* Magic Mirror
* Module: Weather
*
@ -125,7 +127,7 @@ WeatherProvider.register("ukmetofficedatahub", {
let nowUtc = moment.utc();
// Find hour that contains the current time
for (hour in forecastDataHours) {
for (let hour in forecastDataHours) {
let forecastTime = moment.utc(forecastDataHours[hour].time);
if (nowUtc.isSameOrAfter(forecastTime) && nowUtc.isBefore(moment(forecastTime.add(1, "h")))) {
currentWeather.date = forecastTime;
@ -196,7 +198,7 @@ WeatherProvider.register("ukmetofficedatahub", {
let today = moment.utc().startOf("date");
// Go through each day in the forecasts
for (day in forecastDataDays) {
for (let day in forecastDataDays) {
const forecastWeather = new WeatherObject(this.config.units, this.config.tempUnits, this.config.windUnits, this.config.useKmh);
// Get date of forecast