Moment Node - output "Today, Tomorrow, Tuesday, Next Monday"

I have a moment node that I am trying to get it to output either Today, Tomorrow, Tuesday

I set the moment node to Output Format "calendar" but it gives me the time as well as the day.

Example
Input: 2022-11-28T00:00:00+00:00
output: Monday at 12:00 AM

How can I strip the time off? I would just like it to say "Monday"

Many thanks for your help

Example flow

[{"id":"19df6d4998d850db","type":"inject","z":"ea42b334.b6a77","name":"Test","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1850,"y":1460,"wires":[["67888d8899fbca22"]]},{"id":"67888d8899fbca22","type":"function","z":"ea42b334.b6a77","name":"sample msg","func":"msg = { \"_msgid\": \"41d7d21583d89be9\", \"payload\": \"green\", \"IFTTT\": true, \"data\": { \"entity_id\": \"sensor.green_bin\", \"state\": 1, \"attributes\": { \"days\": 11, \"last_collection\": \"2022-10-23T21:39:16.693427+01:00\", \"last_updated\": \"2022-11-24T20:37:20.123738+00:00\", \"next_date\": \"2022-11-28T00:00:00+00:00\", \"device_class\": \"garbage_collection__schedule\", \"icon\": \"mdi:trash-can\", \"friendly_name\": \"Green Bin\" }, \"last_changed\": \"2022-11-24T20:35:29.591369+00:00\", \"last_updated\": \"2022-11-24T20:37:20.137238+00:00\", \"context\": { \"id\": \"01GJNNQW49TD23HS6MAX33VH6G\", \"parent_id\": null, \"user_id\": null }, \"timeSinceChangedMs\": 2978942, \"original_state\": \"2\" } }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1990,"y":1460,"wires":[["04e686ee65216948"]]},{"id":"04e686ee65216948","type":"moment","z":"ea42b334.b6a77","name":"","topic":"","input":"data.attributes.next_date","inputType":"msg","inTz":"Europe/London","adjAmount":0,"adjType":"days","adjDir":"add","format":"calendar","locale":"","output":"due_day","outputType":"msg","outTz":"Europe/London","x":2180,"y":1460,"wires":[["ddda907dc8b17c4b"]]},{"id":"ddda907dc8b17c4b","type":"debug","z":"ea42b334.b6a77","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":2350,"y":1460,"wires":[]}]

Capture

Try dddd in the output format field.
Scratch that,. You could use moment in the change node then split the result and return first element.
e.g.

[{"id":"61cfc78bf399aa07","type":"change","z":"452103ea51141731","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$split($moment($$.payload).tz(\"Europe/London\").calendar(), \" at \")[0]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":3800,"wires":[["d49d7b6a3cc54421"]]},{"id":"fbe9bbb9c86166cc","type":"inject","z":"452103ea51141731","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1669221658653","payloadType":"num","x":160,"y":3800,"wires":[["61cfc78bf399aa07"]]},{"id":"d49d7b6a3cc54421","type":"debug","z":"452103ea51141731","name":"debug 109","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":550,"y":3800,"wires":[]}]

That is neat thank you!

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