Hi there!
I try to play with Date() inside a function block and found something curious...non blocking, but I would be happy to understand.
I need a timestamp in millisecond style (a non formatted integer) so I can easily compare or do some processing.
at first I tried this:
var test = new Date();
msg.payload = test;
return msg;
And output this on a debug box.
debug windows shows:
payload: "2020-07-17T12:39:02.927Z"
The date is written in read a looks like a formatted text output, so I thought I may not be able to use this for comparison or operation, but just in case, I tried this:
var test = new Date();
msg.payload = test - 3600000;
return msg;
This time the debug windows shows a numeric payload, written in blue:
payload: 1594985920276
I can click on the blue value to see different format like:
payload: 2020-07-17T11:38:40.276Z
So it seems fine: I guess I can do what I need to do with my "test = new Date();".
But I wonder why it shows like a formatted string if I do not modify my value...?