# Sending a message with a value to a ui-form node time field

**URL:** <https://discourse.nodered.org/t/sending-a-message-with-a-value-to-a-ui-form-node-time-field/53062>\
**Category:** Dashboard\
**Created:** [1 November 2021 11:32 UTC](https://discourse.nodered.org/t/sending-a-message-with-a-value-to-a-ui-form-node-time-field/53062 "2021-11-01T11:32:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![davec1001](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@davec1001](https://discourse.nodered.org/u/davec1001)\
**Post date:** [1 November 2021 11:32 UTC](https://discourse.nodered.org/t/sending-a-message-with-a-value-to-a-ui-form-node-time-field/53062/1 "2021-11-01T11:32:43Z")

</div>

Is this possible? Has anyone achieved it? I tried looking at the output from the time field (which is a date of 1/1/1970 plus the time) and then tried lots of ways of creating such a date for the time I wanted.

I also tried converting the time to ms from midnight and send that as a number

---

<div class="post-metadata">

**Author:** ![davec1001](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@davec1001](https://discourse.nodered.org/u/davec1001)\
**Post date:** [6 November 2021 18:11 UTC](https://discourse.nodered.org/t/sending-a-message-with-a-value-to-a-ui-form-node-time-field/53062/2 "2021-11-06T18:11:11Z")

</div>

Is it supposed to be possible?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 November 2021 21:51 UTC](https://discourse.nodered.org/t/sending-a-message-with-a-value-to-a-ui-form-node-time-field/53062/3 "2021-11-07T21:51:48Z")

</div>

Have you tried sending a Date object? Also try the number of milliseconds into the day. If neither works then post a flow just with an inject and the form node, so we can be absolutely certain we are trying to do the same as you.

---

<div class="post-metadata">

**Author:** ![davec1001](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@davec1001](https://discourse.nodered.org/u/davec1001)\
**Post date:** [7 November 2021 23:43 UTC](https://discourse.nodered.org/t/sending-a-message-with-a-value-to-a-ui-form-node-time-field/53062/4 "2021-11-07T23:43:13Z")

</div>

Thanks for your attention. Yes I have posted a date object. I've tried an awful lot of things. I can't get any reaction out of the time field on the form at all. I guess I must be doing something silly.

I attach my flow, 4 different tests trying -:  
Test 1 Sending the same string from the output (copied manually from a debug node)  
Test 2 Sending a date object  
Test 3 Sending some millis (Desperation!)  
Test 4 Sending the current date object

hmmmm...As I was typing this, I thought something I hadn't tried. I created a second form and wired the output from the first form to the input of the second form and keyed the time in. The date and text fields both appeared on the second form but the time did not!! (I haven't included this test below)

Here is the flow

```auto
[{"id":"f6ee4f19da65bed0","type":"inject","z":"99578642f6dfcf6a","name":"Test1","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Test1","payloadType":"date","x":380,"y":160,"wires":[["8f04445decbb12cc"]]},{"id":"d416baa7e0fef104","type":"inject","z":"99578642f6dfcf6a","name":"Test2","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Test2","payloadType":"date","x":380,"y":240,"wires":[["8f04445decbb12cc"]]},{"id":"c9213ff2bf89833c","type":"inject","z":"99578642f6dfcf6a","name":"Test3","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Test3","payloadType":"date","x":380,"y":320,"wires":[["8f04445decbb12cc"]]},{"id":"759e3c490e233e9f","type":"debug","z":"99578642f6dfcf6a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1110,"y":260,"wires":[]},{"id":"8f04445decbb12cc","type":"function","z":"99578642f6dfcf6a","name":"","func":"let newMsg = {};\nnewMsg.topic = msg.topic;\nnewMsg.payload = {};\nif (msg.topic == \"Test1\") {\n newMsg.payload.testText = \"Trying Time with Date String same as output\"\n newMsg.payload.testDate = \"2021-11-01T00:00:00.000Z\"\n newMsg.payload.testTime = \"1970-01-01T08:30:00.000Z\"\n}\nif (msg.topic == \"Test2\") {\n timeDateObject = new Date(\"1970-01-01T08:30:00.000Z\");\n newMsg.payload.testText = \"Trying Time with Date Object\"\n newMsg.payload.testDate = \"2021-11-01T00:00:00.000Z\"\n newMsg.payload.testTime = timeDateObject\n}\nif (msg.topic == \"Test3\") {\n newMsg.payload.testText = \"Trying Time 12 minutes of milliseconds\"\n newMsg.payload.testDate = \"2021-11-01T00:00:00.000Z\"\n newMsg.payload.testTime = 12 * 60 * 1000\n}\nif (msg.topic == \"Test4\") {\n timeDateObject = new Date();\n newMsg.payload.testText = \"Trying Time (and Date) with current date\"\n newMsg.payload.testDate = timeDateObject\n newMsg.payload.testTime = timeDateObject\n}\n\nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":260,"wires":[["a96cbaf6e99a8e95"]]},{"id":"a96cbaf6e99a8e95","type":"ui_form","z":"99578642f6dfcf6a","name":"","label":"","group":"e283bda8fc976c1d","order":2,"width":0,"height":0,"options":[{"label":"TestText","value":"testText","type":"text","required":true,"rows":null},{"label":"TestDate","value":"testDate","type":"date","required":true,"rows":null},{"label":"TestTime","value":"testTime","type":"time","required":true,"rows":null}],"formValue":{"testText":"","testDate":"","testTime":""},"payload":"","submit":"submit","cancel":"cancel","topic":"topic","topicType":"msg","splitLayout":"","x":870,"y":260,"wires":[["759e3c490e233e9f"]]},{"id":"888193c1ca0827b1","type":"inject","z":"99578642f6dfcf6a","name":"Test4","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Test4","payloadType":"date","x":370,"y":380,"wires":[["8f04445decbb12cc"]]},{"id":"e283bda8fc976c1d","type":"ui_group","name":"Time On Form Test","tab":"4971deb59d615ef2","order":1,"disp":true,"width":"8","collapse":false},{"id":"4971deb59d615ef2","type":"ui_tab","name":"Time on Form Test","icon":"dashboard","order":5,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 November 2021 10:04 UTC](https://discourse.nodered.org/t/sending-a-message-with-a-value-to-a-ui-form-node-time-field/53062/5 "2021-11-08T10:04:43Z")

</div>

All four of those examples work for me. What versions of node-red and node-red-dashboard are you using? If you are not using the latest dashboard then upgrade it. If that doesn't help then what browser are you using, on what OS?

---

<div class="post-metadata">

**Author:** ![davec1001](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@davec1001](https://discourse.nodered.org/u/davec1001)\
**Post date:** [8 November 2021 10:15 UTC](https://discourse.nodered.org/t/sending-a-message-with-a-value-to-a-ui-form-node-time-field/53062/6 "2021-11-08T10:15:59Z")

</div>

omigod! What an idiot......old dashboard Sorry to have wasted your time

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 November 2021 10:23 UTC](https://discourse.nodered.org/t/sending-a-message-with-a-value-to-a-ui-form-node-time-field/53062/7 "2021-11-08T10:23:27Z")

</div>

No problem, glad to have been of help.

---

<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:** [22 November 2021 10:23 UTC](https://discourse.nodered.org/t/sending-a-message-with-a-value-to-a-ui-form-node-time-field/53062/8 "2021-11-22T10:23:34Z")

</div>

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