Time parsing - how to cut up time messages

Indeed. According to the split node help

The behaviour of the node is determined by the type of msg.payload :

The output of the moment node is a string, so the split node will disregard the configuration you entered for copying key to msg.blah.

You want to transform a string into an array. This is similar to what has been discussed in this post

You can apply the same solution, a split node + join node.

Testing flow:

[{"id":"5a4f00a0.1539d","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"9496950a.d98538","type":"inject","z":"5a4f00a0.1539d","name":"Foo","topic":"","payload":"foo","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":280,"wires":[["a8bc1ecd.231c"]]},{"id":"a8bc1ecd.231c","type":"function","z":"5a4f00a0.1539d","name":"","func":"msg.payload = new Date().toLocaleString();\nreturn msg;","outputs":1,"noerr":0,"x":250,"y":280,"wires":[["e98349ab.6a3558"]]},{"id":"e98349ab.6a3558","type":"moment","z":"5a4f00a0.1539d","name":"","topic":"","input":"","inputType":"msg","inTz":"Australia/Sydney","adjAmount":0,"adjType":"days","adjDir":"add","format":"HH:mm:ss","locale":"en_AU","output":"","outputType":"msg","outTz":"Australia/Sydney","x":420,"y":280,"wires":[["6f0835.a09d27cc"]]},{"id":"f0b653ec.00866","type":"debug","z":"5a4f00a0.1539d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":850,"y":280,"wires":[]},{"id":"6f0835.a09d27cc","type":"split","z":"5a4f00a0.1539d","name":"","splt":":","spltType":"str","arraySplt":"2","arraySpltType":"len","stream":false,"addname":"","x":590,"y":280,"wires":[["79820f63.5886a"]]},{"id":"79820f63.5886a","type":"join","z":"5a4f00a0.1539d","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":710,"y":280,"wires":[["f0b653ec.00866"]]}]
1 Like