Time and date not making sense to me

The time now (local) is 22:40 3 Sept 2020
Give or take for the minutes/seconds.

This is an extract of a flow:

[{"id":"4b8ef85a.3c413","type":"inject","z":"242538c4.33ddf8","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"foo","payloadType":"str","x":950,"y":400,"wires":[["6f7a47b7.c516f"]]},{"id":"6f7a47b7.c516f","type":"function","z":"242538c4.33ddf8","name":"","func":"msg.payload = new Date();\nreturn msg;","outputs":1,"noerr":0,"x":1080,"y":360,"wires":[["55fe9b1f.9f8dcc","6aa131c7.5dd078"]]},{"id":"6aa131c7.5dd078","type":"debug","z":"242538c4.33ddf8","name":"Time now?","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1260,"y":360,"wires":[]},{"id":"55fe9b1f.9f8dcc","type":"moment","z":"242538c4.33ddf8","name":"","topic":"","input":"","inputType":"msg","inTz":"Australia/Sydney","adjAmount":0,"adjType":"days","adjDir":"add","format":"DD/MMM/YY","locale":"en_AU","output":"","outputType":"msg","outTz":"Australia/Sydney","x":800,"y":700,"wires":[["24878a03.064a9e","3773775b.e93c08","7f97eb1f.8519a4"]]},{"id":"7f97eb1f.8519a4","type":"debug","z":"242538c4.33ddf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":990,"y":650,"wires":[]},{"id":"3773775b.e93c08","type":"moment","z":"242538c4.33ddf8","name":"","topic":"","input":"","inputType":"msg","inTz":"Australia/Sydney","adjAmount":0,"adjType":"days","adjDir":"add","format":"ddd","locale":"en_AU","output":"","outputType":"msg","outTz":"Australia/Sydney","x":800,"y":850,"wires":[["309edecd.303782","bc956c32.a9829"]]},{"id":"bc956c32.a9829","type":"debug","z":"242538c4.33ddf8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":950,"y":810,"wires":[]}]

I am making a clock. (Re-inventing the wheel)

So, all things are looking kind of good, but then I noticed the week day.

SUNDAY

All the debug nodes are showing me the right times and dates.

As per this picture.

It is the moment node.

The bottom one gets the week day by having ddd in the field.
To save you having to load the flow and look.
I searched and ddd gives the week day in 3 letters.
(Or that's what it said when I found it when I searched)
All the same, I can't see 3 days difference between now and Sunday.

Now, even considering we are not using Z time which is shown in one of the debug outputs.....

I fail to see how today is Thursday, yet I am being told it is Sunday.

Yes: I've missed another elephant.
But what can I say?

You don’t show how you configured the moment node....

I just posted it.

ddd for day of week.

The complete configuration please

[{"id":"3773775b.e93c08","type":"moment","z":"242538c4.33ddf8","name":"","topic":"","input":"","inputType":"msg","inTz":"Australia/Sydney","adjAmount":0,"adjType":"days","adjDir":"add","format":"ddd","locale":"en_AU","output":"","outputType":"msg","outTz":"Australia/Sydney","x":800,"y":850,"wires":[["309edecd.303782","bc956c32.a9829"]]}]

It looks to me that you are daisy chaining the output of the moment nodes.

Try feeding the bottom node with the same input as the one above it

Fair enough on that.

I'll try it, but if you see, it has the right date going into it.

WooHoo!

We found a bug - IMO

But it is weird in the top picture you see the correct date being sent out.
And even with all the time offset you can't wrap from Thursday to Sunday by being in the wrong time zone.

I think its not a bug - its just that the moment node doesn't understand the time format of 03/Sep/20

You havent defined in moment config that the date you want to process is from msg.payload
its greyd out .. force it .. to payload

[{"id":"ebe82477.8506f8","type":"inject","z":"f54b08eb.e98bb","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"foo","payloadType":"str","x":710,"y":340,"wires":[["ec77bb8f.30e178"]]},{"id":"ec77bb8f.30e178","type":"function","z":"f54b08eb.e98bb","name":"","func":"msg.payload = new Date();\nreturn msg;","outputs":1,"noerr":0,"x":840,"y":300,"wires":[["87b6c2a5.28e4b","bdada695.d332f8"]]},{"id":"bdada695.d332f8","type":"debug","z":"f54b08eb.e98bb","name":"Time now?","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1020,"y":300,"wires":[]},{"id":"87b6c2a5.28e4b","type":"moment","z":"f54b08eb.e98bb","name":"","topic":"","input":"payload","inputType":"msg","inTz":"Australia/Sydney","adjAmount":0,"adjType":"days","adjDir":"add","format":"DD/MMM/YY","locale":"en_AU","output":"dt","outputType":"msg","outTz":"Australia/Sydney","x":560,"y":640,"wires":[["bbf47a06.78ea2","726df110.86888"]]},{"id":"726df110.86888","type":"debug","z":"f54b08eb.e98bb","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"dt","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":590,"wires":[]},{"id":"bbf47a06.78ea2","type":"moment","z":"f54b08eb.e98bb","name":"","topic":"","input":"payload","inputType":"msg","inTz":"Australia/Sydney","adjAmount":0,"adjType":"days","adjDir":"add","format":"ddd","locale":"en_AU","output":"dt","outputType":"msg","outTz":"Australia/Sydney","x":560,"y":790,"wires":[["d03fc65c.a47098"]]},{"id":"d03fc65c.a47098","type":"debug","z":"f54b08eb.e98bb","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"dt","targetType":"msg","statusVal":"","statusType":"auto","x":710,"y":750,"wires":[]}]

but maybe you are right .. the moment node should have notified that its unconfigured .. or maybe its not really defaulting to ... msg.payload?!

my test configuration

Output in msg.dt

image

If the moment node receives an invalid input, it should output a warning message to debug. I haven't looked at the code recently but I'm pretty sure that if it gets something it can't deal with it outputs an empty string.

In this case @Trying_to_learn clicked done in configuration without defining input and output, even if there was a big fat RED highlight on those fields :smiley:

Andrew companies should hire you as a software tester. You haven't left a node in node-red un-penetrated from every single input-output with every possible value. numbers arrays objects dates .. you name it :wink:

Well, thin (1-2px) red highlight to be exact. :wink:

I did see that and even filling in the payload made no difference to the output.

But, yes, I probably should fill the field in.

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