mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Fix warning in weather provider
This commit is contained in:
parent
bcc0cc599d
commit
bcff953fbb
@ -359,7 +359,7 @@ WeatherProvider.register("envcanada", {
|
|||||||
var lastDate = moment(baseDate, "YYYYMMDDhhmmss");
|
var lastDate = moment(baseDate, "YYYYMMDDhhmmss");
|
||||||
|
|
||||||
for (var stepDay = nextDay; stepDay < lastDay; stepDay += 2) {
|
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
|
// Add 1 to the date to reflect the current forecast day we are building
|
||||||
|
|
||||||
|
@ -216,12 +216,12 @@ WeatherProvider.register("smhi", {
|
|||||||
*/
|
*/
|
||||||
fillInGaps(data) {
|
fillInGaps(data) {
|
||||||
let result = [];
|
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 to = moment(data[i].validTime);
|
||||||
let from = moment(data[i - 1].validTime);
|
let from = moment(data[i - 1].validTime);
|
||||||
let hours = moment.duration(to.diff(from)).asHours();
|
let hours = moment.duration(to.diff(from)).asHours();
|
||||||
// For each hour add a datapoint but change the validTime
|
// 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]);
|
let current = Object.assign({}, data[i]);
|
||||||
current.validTime = from.clone().add(j, "hours").toISOString();
|
current.validTime = from.clone().add(j, "hours").toISOString();
|
||||||
result.push(current);
|
result.push(current);
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* global WeatherProvider, WeatherObject, SunCalc */
|
||||||
|
|
||||||
/* Magic Mirror
|
/* Magic Mirror
|
||||||
* Module: Weather
|
* Module: Weather
|
||||||
*
|
*
|
||||||
@ -125,7 +127,7 @@ WeatherProvider.register("ukmetofficedatahub", {
|
|||||||
let nowUtc = moment.utc();
|
let nowUtc = moment.utc();
|
||||||
|
|
||||||
// Find hour that contains the current time
|
// Find hour that contains the current time
|
||||||
for (hour in forecastDataHours) {
|
for (let hour in forecastDataHours) {
|
||||||
let forecastTime = moment.utc(forecastDataHours[hour].time);
|
let forecastTime = moment.utc(forecastDataHours[hour].time);
|
||||||
if (nowUtc.isSameOrAfter(forecastTime) && nowUtc.isBefore(moment(forecastTime.add(1, "h")))) {
|
if (nowUtc.isSameOrAfter(forecastTime) && nowUtc.isBefore(moment(forecastTime.add(1, "h")))) {
|
||||||
currentWeather.date = forecastTime;
|
currentWeather.date = forecastTime;
|
||||||
@ -196,7 +198,7 @@ WeatherProvider.register("ukmetofficedatahub", {
|
|||||||
let today = moment.utc().startOf("date");
|
let today = moment.utc().startOf("date");
|
||||||
|
|
||||||
// Go through each day in the forecasts
|
// 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);
|
const forecastWeather = new WeatherObject(this.config.units, this.config.tempUnits, this.config.windUnits, this.config.useKmh);
|
||||||
|
|
||||||
// Get date of forecast
|
// Get date of forecast
|
||||||
|
Loading…
x
Reference in New Issue
Block a user