MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

MM 2.11.0 Invalid Date error with weather module



  • Hi all, I’m a relative novice but have successfully built MM and upgraded it a couple of times. Recently, I recognized that Openweather wasn’t providing very accurate weather information, for either the current or the forecast. After switching to weathergov and figuring out the correct end points, I noticed an “Invalid date” error on the current weather. Note that I use the weather module for current and forecast weather for two different locations… I only receive the invalid date error for the first location.

    I’ve searched the forums and see similar issues related to much earlier versions of MM. None of them seem to relate directly to this issue.

    I use 24 hour military time and have specified that format for the clock module. Would that have any impact on how the weather module wants to interpret and display time? Would a “spring or summer” sunset time cause the issue? My config.js file is pasted below.

    On an unrelated note… should I use boolean true and false values or place them in quotes?

    Here’s a pic of the error:
    7c75e197-1be2-4622-848b-7588aa3887c3-image.png

    How the heck can I upload my config.js file? Everything I try screws up the formatting so that it’s hard to read and troubleshoot.

    Here’s the code for the weather with the invalid date error:

    	{
    		module: "weather",
    		position: "top_left",
    		classes: "daytime_scheduler",
    		config: {
    			weatherProvider: "weathergov",
    			type: "current",
    			degreeLabel: "true",
    			appendLocationNameToHeader: true,
    			apiBase: "https://api.weather.gov/gridpoints/MFR/",
    			weatherEndpoint: "/forecast/hourly",
    			lat: "104", // "-122.63157",
    			lon: "44", //"41.72403",
    		}
    	},
    

    Thanks in advance,
    Scott



  • @Jarhead96097 if there are true/false values in config, they should not be quoted



  • @sdetweil thank you. I’ll make the corrections.



  • Is there a way for me to check the forecast data from the local weather station? Since I’m only getting the error using the “weathergov” source, and it’s only happening with the first of two weather instances… I’m wondering if the underlying data might be the issue. The only problem with that theory is that the error is constant, across all of the forecasts I’ve received since rebuilding MM using version 2.11.0.



  • @Jarhead96097 you can read the code and try to build the request url string that you could put into the browser on your pc to get the response to examine…

    there are no prebuilt tools for this



  • @sdetweil Thank you for such quick responses…I do appreciate it! Here’s the link: https://api.weather.gov/gridpoints/MFR/104,44/forecast/hourly and here’s a snippet of the return that includes the dates and times that end up (apparently) causing the invalid date error:

    "properties": {
        "updated": "2020-06-05T01:18:34+00:00",
        "units": "us",
        "forecastGenerator": "HourlyForecastGenerator",
        "generatedAt": "2020-06-05T04:36:11+00:00",
        "updateTime": "2020-06-05T01:18:34+00:00",
        "validTimes": "2020-06-04T19:00:00+00:00/P7DT17H",
        "elevation": {
            "value": 868.98480000000006,
            "unitCode": "unit:m"
        },
    

    Based on what I can compare against the moment.js documentation, I don’t see anything obvious that would cause the error.


Log in to reply