Ok, I have shared a "node" (Sub-flow) recently which has three outputs.
msg.payload
that is suitable for use as a file name.
msg.payload
that is suitable for use as a path.
msg.time
which is suitable for use as a file name.
It works.
Well, it kind of does and kind of doesn't.
I posted it to the forum and didn't get any feedback on a problem so I thought all was good.
But then locally I started to see problems.
Rather than the output being YYYY-MM-DD it was YYYY-DD-MM which is annoying when looking at time lines.
I opened the sub flow and looked at it and was shocked to see when I used the moment
node, I had goofed and put YYYY-DD-MM
by mistake. (Or so I thought)
I quickly changed the code to YYYY-MM-DD
and thought nothing more of it.
Today, I am going through checking things and am still seeing the output as DD-MM.
I have checked two of my 3 Raspies and they are both doing it.
Weirdly the third isn't.
Also the NUC - this machine - is also doing it - wrong format.
To further confuse me, the code is the sub-flow is correct in that it says YYYY-MM-DD
Yet the output isn't. It is YYYY-DD-MM
Thoughts?
Though I haven't circled all the problems - as looking it it a bit harder you can see it is worse than I show - you get the idea.
This is the code for the three machines:
And for total inclusion this is from the NUC:
I'm obviously missing an elephant in the room.
Anyone?
P.S.
I've moved the "subflow" up to the edit level and made a normal flow of it.
For your assistance to helping me understand what is happening:
[{"id":"313e36fb.b31f22","type":"function","z":"8aae5d25.29cda","name":"Time Stamp","func":"var d = new Date().toLocaleString();\nmsg.payload = d;\nreturn msg;","outputs":1,"noerr":0,"x":230,"y":330,"wires":[["caa524bf.b5eb5"]]},{"id":"caa524bf.b5eb5","type":"moment","z":"8aae5d25.29cda","name":"","topic":"","input":"","inputType":"msg","inTz":"Australia/Sydney","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYY-DD-MM HH:mm:ss","locale":"en_AU","output":"","outputType":"msg","outTz":"Australia/Sydney","x":420,"y":330,"wires":[["183c417e.5ff80f","2aa29446.e3b18c","44c65d67.898004"]]},{"id":"183c417e.5ff80f","type":"string","z":"8aae5d25.29cda","name":"","methods":[{"name":"replaceAll","params":[{"type":"str","value":":"},{"type":"str","value":""}]},{"name":"replaceAll","params":[{"type":"str","value":" "},{"type":"str","value":""}]}],"prop":"payload","propout":"payload","object":"msg","objectout":"msg","x":470,"y":430,"wires":[["1d4c891d.8581bf"]]},{"id":"2aa29446.e3b18c","type":"change","z":"8aae5d25.29cda","name":"TOPIC","rules":[{"t":"move","p":"payload","pt":"msg","to":"time","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":380,"wires":[["729727c3.bfca3"]]},{"id":"3f32eab6.ff56e6","type":"change","z":"8aae5d25.29cda","name":"Save","rules":[{"t":"set","p":"payload","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":290,"wires":[["313e36fb.b31f22"]]},{"id":"729727c3.bfca3","type":"change","z":"8aae5d25.29cda","name":"Get","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":380,"wires":[["5ed635f.678a64c"]]},{"id":"d8ad12e6.c3e7f8","type":"inject","z":"8aae5d25.29cda","name":"","topic":"","payload":"foo","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":290,"wires":[["3f32eab6.ff56e6"]]},{"id":"44c65d67.898004","type":"debug","z":"8aae5d25.29cda","name":"1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":660,"y":330,"wires":[]},{"id":"5ed635f.678a64c","type":"debug","z":"8aae5d25.29cda","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"time","targetType":"msg","x":660,"y":380,"wires":[]},{"id":"1d4c891d.8581bf","type":"debug","z":"8aae5d25.29cda","name":"3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":660,"y":430,"wires":[]}]