Read the statement by Michael Teeuw here.
Weather forecast only displays 'invalid date'
-
@agp42 said in Weather forecast only displays ‘invalid date’:
I did change the following on the file “/MagicMirror/modules/default/weatherferecast/weatherforecast.js” :
Thanks a lot. I got it.
I found a solution on https://github.com/MichMich/MagicMirror/commit/0e2e8d2e2aca2f8d0f1f2eb7b213577fcc4f623a
But I had to change the lines 338 and 339 instead of 336 and 337var day = moment(forecast.dt_txt, "YYYY-MM-DD hh:mm:ss").format("ddd"); var hour = moment(forecast.dt_txt, "YYYY-MM-DD hh:mm:ss").format("H");
into
var day; var hour; if(!!forecast.dt_txt) { day = moment(forecast.dt_txt, "YYYY-MM-DD hh:mm:ss").format("ddd"); hour = moment(forecast.dt_txt, "YYYY-MM-DD hh:mm:ss").format("H"); } else { day = moment(forecast.dt, "X").format("ddd"); hour = moment(forecast.dt, "X").format("H"); }
It works for my MM.
-
Looks like the recent changes here are the culprit. They already figured out what needs to be changed, fixed in an upcoming update. Pull request is in. Get ready to update your mirrors.
-
@bob how did you get you icons to change color as well as your text?
-
@killing-joke said in Weather forecast only displays ‘invalid date’:
I found a solution on https://github.com/MichMich/MagicMirror/commit/0e2e8d2e2aca2f8d0f1f2eb7b213577fcc4f623a
But I had to change the lines 338 and 339 instead of 336 and 337var day = moment(forecast.dt_txt, "YYYY-MM-DD hh:mm:ss").format("ddd"); var hour = moment(forecast.dt_txt, "YYYY-MM-DD hh:mm:ss").format("H");
into
var day; var hour; if(!!forecast.dt_txt) { day = moment(forecast.dt_txt, "YYYY-MM-DD hh:mm:ss").format("ddd"); hour = moment(forecast.dt_txt, "YYYY-MM-DD hh:mm:ss").format("H"); } else { day = moment(forecast.dt, "X").format("ddd"); hour = moment(forecast.dt, "X").format("H"); }
It works for my MM.
Works fine, thank you for the advice !
-
Ive just merged the fix by @jannekalliola into the develop branch which should solve this issue: https://github.com/MichMich/MagicMirror/pull/1341
Can you guys please test this develop branch? If this solves the issue, I’ll release an intermediate 2.4.1 release.
To tryout the develop branch, use the following git command on your terminal (from within the MagicMirror folder):
git checkout develop git pull
Thanks for testing!
-
I edited the code snippet and now my time is stuck on 8:01 on the current forecast…
-
Stuck time might be the sunset time. Mine is 21:17, so not stuck al all.
-
@richard238 hahaha you are right, I’m a imbecile.
-
Awesome, v2.4.1 fixed it
Thanks @MichMich :)