# Imported and deployed flow from the "Creating your first flow" tutorial produces "Invalid Date" in debug

**URL:** <https://discourse.nodered.org/t/imported-and-deployed-flow-from-the-creating-your-first-flow-tutorial-produces-invalid-date-in-debug/52210>\
**Category:** General\
**Created:** [14 October 2021 11:34 UTC](https://discourse.nodered.org/t/imported-and-deployed-flow-from-the-creating-your-first-flow-tutorial-produces-invalid-date-in-debug/52210 "2021-10-14T11:34:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ackalker](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ackalker/32/49253_2.png) [@ackalker](https://discourse.nodered.org/u/ackalker)\
**Post date:** [14 October 2021 11:34 UTC](https://discourse.nodered.org/t/imported-and-deployed-flow-from-the-creating-your-first-flow-tutorial-produces-invalid-date-in-debug/52210/1 "2021-10-14T11:34:22Z")

</div>

As an experiment, I

- did a fresh install of Node-RED
- moved my existing `$HOME/.node-red` directory aside
- started Node-RED
- copied the flow at the bottom of the [Creating your first flow](https://nodered.org/docs/tutorials/first-flow) tutorial
- imported the flow in Node-RED
- deployed

When I then clicked on the button of the inject node, the debug view shows "Invalid Date" as message payload.

On a whim (having read about similar fixes), I double-clicked the function node and clicked 'DONE' (without making any changes in the code editor) and deployed again: still the same result, "Invalid Date".

Next, I double-clicked the inject node and clicked 'DONE' (again without making any changes) and deployed again: succes! Now I get the full textual date as debug output:

 ![2021-10-14-132131_1920x1080_scrot](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/c/5ce2e80ec9f4503c0bce8094d8d1ac54cde4df62.png)

Later, it occurred to me I could add another debug node and wire it directly to the inject node to see what message payload it was outputting:

 ![2021-10-14-152444_1920x1080_scrot](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/0/4015cf232569b6ef0aea8abf445d9bba3368a577.png)

The inject node in the mported flow appeared to output a message with an empty string as payload, not a timestamp.  
After 'fixing' the inject node, it appeared to output a timestamp as expected.

My setup:

OS: Void Linux (x86\_64, rolling release)  
Node-RED version: v2.0.6 (installed using `npm install -g node-red`)

Some questions:

1. Could this issue be caused by the flow that I copied and imported being for an older version of Node-RED?
2. I seem to have 'fixed' it by editing some node properties without actually changing anything, wouldn't it be nice if this could be automated somehow?

EDIT: Added a screenshot showing the payload output by the imported, un'fixed' inject node

---

<div class="post-metadata">

**Author:** ![ackalker](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ackalker/32/49253_2.png) [@ackalker](https://discourse.nodered.org/u/ackalker)\
**Post date:** [14 October 2021 11:41 UTC](https://discourse.nodered.org/t/imported-and-deployed-flow-from-the-creating-your-first-flow-tutorial-produces-invalid-date-in-debug/52210/2 "2021-10-14T11:41:27Z")

</div>

Out of more curiosity, I backed up my `$HOME/.node-red` directory before and after my 'fix', and lo and behold, some things changed in `flows.json` without me changing anything in the properties or code editor (`.node-red.orig/flows.json` has the untouched imported flow, `.node-red.fixed/flows.json` contains the 'fixed' flow):

```auto
$ diff -u .node-red.orig/flows.json .node-red.fixed/flows.json 
--- .node-red.orig/flows.json	2021-10-14 13:05:10.560336880 +0200
+++ .node-red.fixed/flows.json	2021-10-14 13:07:07.735681196 +0200
@@ -22,11 +22,22 @@
         "type": "inject",
         "z": "da78aa5c497d95d5",
         "name": "",
+ "props": [
+ {
+ "p": "payload"
+ },
+ {
+ "p": "topic",
+ "vt": "str"
+ }
+ ],
         "repeat": "",
+ "crontab": "",
         "once": false,
+ "onceDelay": "",
         "topic": "",
- "payload": "",
- "x": 90,
+ "payloadType": "date",
+ "x": 100,
         "y": 60,
         "wires": [
             [
@@ -41,6 +52,10 @@
         "name": "Format timestamp",
         "func": "// Create a Date object from the payload\nvar date = new Date(msg.payload);\n// Change the payload to be a formatted Date string\nmsg.payload = date.toString();\n// Return the message so it can be sent on\nreturn msg;",
         "outputs": 1,
+ "noerr": 0,
+ "initialize": "",
+ "finalize": "",
+ "libs": [],
         "x": 290,
         "y": 60,
         "wires": [

```

Does this indicate that there was a version mismatch that got corrected somehow between the flow I imported and the Node-RED I'm using?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [13 December 2021 11:42 UTC](https://discourse.nodered.org/t/imported-and-deployed-flow-from-the-creating-your-first-flow-tutorial-produces-invalid-date-in-debug/52210/3 "2021-12-13T11:42:24Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
