# Date format different in debug 'msg.payload' vrs 'complete msg object'

**URL:** <https://discourse.nodered.org/t/date-format-different-in-debug-msg-payload-vrs-complete-msg-object/10285>\
**Category:** General\
**Created:** [17 April 2019 12:19 UTC](https://discourse.nodered.org/t/date-format-different-in-debug-msg-payload-vrs-complete-msg-object/10285 "2019-04-17T12:19:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [17 April 2019 12:19 UTC](https://discourse.nodered.org/t/date-format-different-in-debug-msg-payload-vrs-complete-msg-object/10285/1 "2019-04-17T12:19:07Z")

</div>

Node-red v0.20.5  
node.js v10.15.3  
macOS 10.13.6

I just ran into a strange issue using debugs to display the date.

The flow is an `inject` connected to a `function` connected to two `debug` nodes - one displaying the complete msg object the other displaying msg.payload. The function is

```auto
msg.payload = new Date();
return msg;

```

Here is the flow and the debugs:

 ![28%20AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/49ba9067b52bb3a111d67ccddd0096c9abbdfe2f.png)

Notice the different way the date is being displayed. Shouldn't it show the same way??

```auto
[{"id":"73856941.30394","type":"debug","z":"425023c2.794014","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":830,"y":120,"wires":[]},{"id":"6fb74403.88b574","type":"function","z":"425023c2.794014","name":"Get date","func":"msg.payload = new Date();\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":160,"wires":[["73856941.30394","3d5e32b1.27160e"]]},{"id":"a19ee0cf.193c58","type":"inject","z":"425023c2.794014","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":460,"y":160,"wires":[["6fb74403.88b574"]]},{"id":"3d5e32b1.27160e","type":"debug","z":"425023c2.794014","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":810,"y":240,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 April 2019 13:22 UTC](https://discourse.nodered.org/t/date-format-different-in-debug-msg-payload-vrs-complete-msg-object/10285/2 "2019-04-17T13:22:03Z")

</div>

That is interesting and a bit odd, but it is of no consequence. They are both correct, and this is only for debugging after all.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [17 April 2019 14:19 UTC](https://discourse.nodered.org/t/date-format-different-in-debug-msg-payload-vrs-complete-msg-object/10285/3 "2019-04-17T14:19:07Z")

</div>

I know the dates are just in a different format and just wanted to make sure that it is an expected feature 😝

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 April 2019 14:45 UTC](https://discourse.nodered.org/t/date-format-different-in-debug-msg-payload-vrs-complete-msg-object/10285/4 "2019-04-17T14:45:03Z")

</div>

Well, I certainly would not have expected it.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [17 April 2019 15:59 UTC](https://discourse.nodered.org/t/date-format-different-in-debug-msg-payload-vrs-complete-msg-object/10285/5 "2019-04-17T15:59:13Z")

</div>

See [https://nodered.org/blog/2017/01/11/version-0-16-released](https://nodered.org/blog/2017/01/11/version-0-16-released)

"If it looks like a date expressed in milliseconds since epoch, another click will show the formatted date."

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [17 April 2019 17:06 UTC](https://discourse.nodered.org/t/date-format-different-in-debug-msg-payload-vrs-complete-msg-object/10285/6 "2019-04-17T17:06:44Z")

</div>

Nope - clicking on the value in the debug does nothing, it's a string.

I added a node.warn in the function and it shows exactly like the the debug set to display msg.payload  
`"Wed Apr 17 2019 19:01:00 GMT+0200 (Central European Summer Time)"`  
while the debug displaying the complere msg object shows

`{"_msgid":"eb1494f3.d5e1e8","topic":"","payload":"2019-04-17T17:01:00.036Z"}`  
so a conversion/formatting is going on when the complete msg object is displayed

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [17 April 2019 18:14 UTC](https://discourse.nodered.org/t/date-format-different-in-debug-msg-payload-vrs-complete-msg-object/10285/7 "2019-04-17T18:14:57Z")

</div>

I don't think needs a huge debate. It is demonstrably treating it differently in the two places. Feel free to raise an issue.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [17 April 2019 20:13 UTC](https://discourse.nodered.org/t/date-format-different-in-debug-msg-payload-vrs-complete-msg-object/10285/8 "2019-04-17T20:13:37Z")

</div>

@knolleary I wasn't trying to cause a debate, I just wanted to point it out because I spotted it and it made me wonder if it was a known 'feature'
