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

**URL:** https://discourse.nodered.org/t/moment-node-output-today-tomorrow-tuesday-next-monday/71214
**Category:** General
**Created:** [24 November 2022 22:54 UTC](https://discourse.nodered.org/t/moment-node-output-today-tomorrow-tuesday-next-monday/71214 "2022-11-24T22:54:39Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![SurfingSpider](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/surfingspider/32/71202_2.png) [@SurfingSpider](https://discourse.nodered.org/u/SurfingSpider)
#### Post date: [24 November 2022 22:54 UTC](https://discourse.nodered.org/t/moment-node-output-today-tomorrow-tuesday-next-monday/71214/1 "2022-11-24T22:54:39Z")

</div>

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

```auto
[{"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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/b/0b58d4c0fbb46f2a69f2f4dd13a173362acc381f.png)

 ![Capture](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/9/29f02a85af96312b1c423f15d4b1afe4c9e2b525.png)

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [24 November 2022 23:15 UTC](https://discourse.nodered.org/t/moment-node-output-today-tomorrow-tuesday-next-monday/71214/2 "2022-11-24T23:15:30Z")

</div>

~~Try `dddd` in the output [format](https://momentjs.com/docs/#/displaying/format/) field.~~  
Scratch that,. You could use moment in the change node then split the result and return first element.  
e.g.

```auto
[{"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":[]}]

```

---

<div class="post-metadata">

### Author: ![SurfingSpider](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/surfingspider/32/71202_2.png) [@SurfingSpider](https://discourse.nodered.org/u/SurfingSpider)
#### Post date: [25 November 2022 16:33 UTC](https://discourse.nodered.org/t/moment-node-output-today-tomorrow-tuesday-next-monday/71214/3 "2022-11-25T16:33:12Z")

</div>

That is neat thank you!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [9 December 2022 16:33 UTC](https://discourse.nodered.org/t/moment-node-output-today-tomorrow-tuesday-next-monday/71214/4 "2022-12-09T16:33:47Z")

</div>

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