Help me to create day counter

Hi i want to create a day counter. from today - the day i wanted(like 01/12/2022) and i want the output to be in days( like "24" days).
can someone help me do this?

Hi boo,

Did you try anything already ? Have you tried searching for help ?
It's always better to have a go yourself then ask for help if you get stuck :crazy_face:

Google for JS date functions or W3Schools is a good site to learn from.

I did a quick google for js countdown to date and there are lots of results, This one could be adapted to do what you want -

You can use $moment() in a change node with JSONata

[{"id":"1e050571.4f7a43","type":"inject","z":"9790f611.6dd06","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"01 00 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"01/12/2022","payloadType":"str","x":150,"y":780,"wires":[["112a6b2c.52dded"]]},{"id":"112a6b2c.52dded","type":"change","z":"9790f611.6dd06","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$string($ceil($moment($$.payload, [\"DD-MM-YYYY\", \"YYYY-MM-DD\"]).diff($moment(), 'hours') / 24)) & \" Days till \" & $$.payload","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":780,"wires":[["8c51a7f9.1e84e8"]]},{"id":"8c51a7f9.1e84e8","type":"debug","z":"9790f611.6dd06","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":620,"y":780,"wires":[]}]


        $moment($$.payload,["DD-MM-YYYY", "YYYY-MM-DD"]).diff($moment(), 'hours')
        / 24
) & " Days till " & $$.payload

thanks both works :heartpulse: