Read the statement by Michael Teeuw here.
Weather forecast only displays 'invalid date'
-
Update
This issue is solved in v2.4.1.
https://forum.magicmirror.builders/topic/7548/v2-4-0-update/2===Begin original post===
This started happening after updating my MM recently and adding the motion detection module (https://github.com/alexyak/motiondetector), but not sure if either are related.Every time the mirror starts up (even if I use pm2 to restart, or unplug and full reboot), my weather forecast just shows the words invalid date).
This had been working for well over a year. The only change to config I made was to add the new module. But I ran the config checker and it says I have no syntax errors.
I can see one other person opened this as an issue after updating, but they never provided logs or anything and thus it was closed.
https://github.com/MichMich/MagicMirror/issues/1292
I’ve generated logs starting at a pm2 restart, and I see no issues flagged:
mm-0 Starting MagicMirror: v2.4.0-dev mm-0 Loading config ... mm-0 Loading module helpers ... mm-0 No helper found for module: alert. mm-0 Initializing new module helper ... mm-0 Module helper loaded: MMM-Motion-Detection mm-0 No helper found for module: clock. mm-0 No helper found for module: MMM-Nest. mm-0 Initializing new module helper ... mm-0 Module helper loaded: calendar mm-0 No helper found for module: currentweather. mm-0 No helper found for module: weatherforecast. mm-0 Initializing new module helper ... mm-0 Module helper loaded: newsfeed mm-0 All module helpers loaded. mm-0 Starting server on port 8080 ... mm-0 Server started ... mm-0 Connecting socket for: MMM-Motion-Detection mm-0 Starting module helper: MMM-Motion-Detection mm-0 Connecting socket for: calendar mm-0 Starting node helper for: calendar mm-0 Connecting socket for: newsfeed mm-0 Starting module: newsfeed mm-0 Sockets connected & modules started ... mm-0 Launching application. mm-0 Create new calendar fetcher for url: h mm-0 Create new news fetcher for url: http://feeds.arstechnica.com/arstechnica/index/ - Interval: 300000 mm-0 Create new news fetcher for url: http://www.npr.org/rss/rss.php?id=1001 - Interval: 300000 mm-0 [MMM-Motion-Detection] Motion Detection started... mm-0 [MMM-Motion-Detection] -------------------- mm-0 [MMM-Motion-Detection] Webcam starting... mm-0 [MMM-Motion-Detection] motion detected mm-0 Starting MagicMirror: v2.4.0-dev mm-0 Loading config ... mm-0 Loading module helpers ... mm-0 No helper found for module: alert. mm-0 Initializing new module helper ... mm-0 Module helper loaded: MMM-Motion-Detection mm-0 No helper found for module: clock. mm-0 No helper found for module: MMM-Nest. mm-0 Initializing new module helper ... mm-0 Module helper loaded: calendar mm-0 No helper found for module: currentweather. mm-0 No helper found for module: weatherforecast. mm-0 Initializing new module helper ... mm-0 Module helper loaded: newsfeed mm-0 All module helpers loaded. mm-0 Starting server on port 8080 ... mm-0 Server started ... mm-0 Connecting socket for: MMM-Motion-Detection mm-0 Starting module helper: MMM-Motion-Detection mm-0 Connecting socket for: calendar mm-0 Starting node helper for: calendar mm-0 Connecting socket for: newsfeed mm-0 Starting module: newsfeed mm-0 Sockets connected & modules started ... mm-0 Launching application. mm-0 Create new news fetcher for url: http://feeds.arstechnica.com/arstechnica/index/ - Interval: 300000 mm-0 Create new news fetcher for url: http://www.npr.org/rss/rss.php?id=1001 - Interval: 300000 mm-0 [MMM-Motion-Detection] Motion Detection started... mm-0 [MMM-Motion-Detection] -------------------- mm-0 [MMM-Motion-Detection] Webcam starting... mm-0 [MMM-Motion-Detection] motion detectedThe only editing I did was to take out the calendar URL from the posted log. Anyone else seen this or have any ideas?
-
might be easier to help if you could post your config.js. But please hide any personal info before posting it.
-
Sure, I can post that. The config checker doesn’t find any issues. Any help appreciated.
/* Magic Mirror Config Sample * * By Michael Teeuw http://michaelteeuw.nl * MIT Licensed. */ var config = { port: 8080, language: 'en', timeFormat: 12, units: 'imperial', modules: [ { module: 'alert', }, { module: 'MMM-Motion-Detection', }, { module: 'clock', position: 'top_left' }, { module: 'MMM-Nest', position: 'bottom_right', config: { token:"xxx" } }, { module: 'calendar', header: 'Calendar', position: 'top_left', config: { calendars: [ { symbol: 'calendar-check-o ', url: 'xxx' } ] } }, { module: 'currentweather', position: 'top_right', config: { location: 'xxx', locationID: 'xxx', //ID from http://www.openweathermap.org appid: 'xxx' } }, { module: 'weatherforecast', position: 'top_right', header: 'Weather Forecast', config: { location: 'xxx', locationID: 'xxx', //ID from http://www.openweathermap.org appid: 'xxx' } }, { module: 'newsfeed', position: 'bottom_bar', config: { feeds: [ { title: "ArsTechnica", url: "http://feeds.arstechnica.com/arstechnica/index/", }, { title: "NPR", url: "http://www.npr.org/rss/rss.php?id=1001" } ], showSourceTitle: true, showPublishDate: true } }, ] }; /*************** DO NOT EDIT THE LINE BELOW ***************/ if (typeof module !== 'undefined') {module.exports = config;} -
2 things to try…
try putting a comma after the motion detection module
module: ‘MMM-Motion-Detection’,
-
No luck adding the comma unfortunately.
You mentioned 2 things to try, what was the second?
Thanks for looking at this.
-
appidincurrentweathermodule is missing a ’Time and date on your raspberry are fine, right?
-
Not sure how I missed that… weird, I swear I put it in there…
Check the time and date of your devices…
-
Thanks for the helpful suggestions.
Date and time are correct on my pi, and the mirror even shows the right date and time.
The config did have the missing ’ in current weather, I apparently accidentally deleted it when I was removing personal info. I edited the above to reflect the current status of my config file.
This was working fine before. About the time I updated the mirror to latest version and added the motion detection module. But it didn’t happen immediately after those events. It was a few days later. I did find a logged issue (that was closed) describing the same thing, after updating the mirror.
-
I’m having the same issue as @Canterrain

Snipp from Clock and Weather modules are below
// Clock { module: "clock", position: "top_center", config: { displayType: "digital", displaySeconds: false, showPeriod: true, showPeriodUpper: false, clockBold: false, showDate: true, showWeek: false, dateFormat : "dddd, MMMM Do YYYY", }, }, // Calendar// Weather - ID from http://www.openweathermap.org/help/city_list.txt { module: "weatherforecast", position: "top_left", header: "7 Day Forecast for ", config: { fade: false, maxNumberOfDays: 7, showRainAmount: true, colored: true, locationID: "2655603", appid: "xxx" }, },Issue only occurred once I did an update to the MM system to v.2.4.0
-
Same issue here
-
same here.
Is there a possibilty to erase the comma and country code behind the location in the header?!
-
Hello,
same problem for me since the update in 2.4.0… So general update issue probably (looking forward for a solution !:slightly_smiling_face: )
To answer @killing-joke said in Weather forecast only displays ‘invalid date’:
same here.
Is there a possibilty to erase the comma and country code behind the location in the header?!
I did change the following on the file “/MagicMirror/modules/default/weatherferecast/weatherforecast.js” :
// Override getHeader method. getHeader: function() { if (this.config.appendLocationNameToHeader) { //line to change //return this.data.header + " " + this.fetchedLocationName; return "Prévisions Météo Nogent"; // write here what you want... } return this.data.header; },Here is the result :
You can of course change the line on the way you want to remove only the part you need.
-
@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 pullThanks 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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login