# Cannot preload Time field in Dashboard form

**URL:** <https://discourse.nodered.org/t/cannot-preload-time-field-in-dashboard-form/50465>\
**Category:** Dashboard\
**Created:** [31 August 2021 22:11 UTC](https://discourse.nodered.org/t/cannot-preload-time-field-in-dashboard-form/50465 "2021-08-31T22:11:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![abesis](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@abesis](https://discourse.nodered.org/u/abesis)\
**Post date:** [31 August 2021 22:11 UTC](https://discourse.nodered.org/t/cannot-preload-time-field-in-dashboard-form/50465/1 "2021-08-31T22:11:03Z")

</div>

I'm trying to preload the **Time** field of a node red dashboard ui form using the incoming `msg`, like so:

 ![2021-08-31 22_21_23-Window](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/7/f70a76c7f51770297bb40ba78fe9041e8d9d82c3.png)

```auto
[{"id":"c1dce9ca4b3f9013","type":"ui_form","z":"30c224646f95e02b","name":"Date form","label":"","group":"903a6ab8.4f4ca8","order":1,"width":0,"height":0,"options":[{"label":"formDate","value":"formDate","type":"date","required":false,"rows":null},{"label":"formTime","value":"formTime","type":"time","required":false,"rows":null}],"formValue":{"formDate":"","formTime":""},"payload":"","submit":"submit","cancel":"cancel","topic":"","topicType":"str","splitLayout":false,"x":1180,"y":1160,"wires":[["c3abdd59a3dcf461"]]},{"id":"ffbc742075c7aa70","type":"function","z":"30c224646f95e02b","name":"Date & Time","func":"msg.payload = {\n formDate: \"2021-08-10T19:24:42.854Z\",\n formTime: \"1970-01-01T20:26:00.000Z\"\n }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":975,"y":1160,"wires":[["c1dce9ca4b3f9013","48e7b13e046a3fbc"]]},{"id":"3287732f7dd33cd2","type":"inject","z":"30c224646f95e02b","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":800,"y":1160,"wires":[["ffbc742075c7aa70"]]},{"id":"48e7b13e046a3fbc","type":"debug","z":"30c224646f95e02b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1190,"y":1200,"wires":[]},{"id":"c3abdd59a3dcf461","type":"debug","z":"30c224646f95e02b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1350,"y":1160,"wires":[]},{"id":"903a6ab8.4f4ca8","type":"ui_group","name":"Home","tab":"e2e6f4f5.56f91","order":1,"disp":false,"width":"6","collapse":false},{"id":"e2e6f4f5.56f91","type":"ui_tab","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

What I'm feeding into the form is the exact output of itshelf, when submiting new values, for example:

```auto
msg.payload = {
    formDate: "2021-08-10T19:24:42.854Z", // Works
    formTime: "1970-01-01T20:26:00.000Z" // Does not work
}
return msg;

```

The **date** field initializes, but the **time** field does not.

![2021-09-01 01_07_32-form](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/5/a5527803f41ff71a7d75a5289627edfea91b610a.png)

Am I missing something? Thanks!

> Node-RED version: v2.0.5  
> Node.js version: v10.24.1  
> Linux 5.10.52-v7l+ arm LE  
> Dashboard version 2.30.0 started at /ui

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [1 September 2021 06:28 UTC](https://discourse.nodered.org/t/cannot-preload-time-field-in-dashboard-form/50465/2 "2021-09-01T06:28:04Z")

</div>

I have tested and confirmed... no apparent way to dynamically load in a time field.

Submitting this gets this...

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/2/12b537a7790d932131d5bccf452c1806c99889b9.png) ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/b/5b0b7ed55c7e137e4969f1163658394e6085b23f.png)

Feeding this back via `function` node get this...  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/a/caa29411cfa9295ff5db907c81cfeba050ed8744.png) ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/d/fd0484abe877aaf05f8cf966e50509648d180b9a.png)

It does seem strange that the submitted **time** output is using the 1970-01-02 date instead of current.

And I think this git-hub issue is referring to the same thing as this topic issue.

> <https://github.com/node-red/node-red-dashboard/issues/711>
>
> To help us understand the issue, please fill-in as much of the following informa…tion as you can:
> 
> in a ui-form time input field unable to be set with default input value.
>  
> \### What are the steps to reproduce?
> Use either a inject node or as my example does connect the output of the ui-form to a delay and then back into the ui-form input.
> 
> \`\[{"id":"c59f17fc.7d3be8","type":"ui\_form","z":"b3c3e994.b8a9b8","name":"Testing","label":"Test Form","group":"60f85836.2b33f8","order":1,"width":0,"height":0,"options":\[{"label":"test time","value":"test\_time","type":"time","required":false,"rows":null},{"label":"test date","value":"test\_date","type":"date","required":false,"rows":null},{"label":"test text","value":"test\_text","type":"text","required":false,"rows":null},{"label":"test chedkbox","value":"test\_checkbox","type":"checkbox","required":false,"rows":null}\],"formValue":{"test\_time":"","test\_date":"","test\_text":"","test\_checkbox":false},"payload":"","submit":"submit","cancel":"cancel","topic":"topic","topicType":"msg","splitLayout":false,"x":200,"y":940,"wires":\[\["9be7ec3e.533a2","1a61ced1.7434b1"\]\]},{"id":"9be7ec3e.533a2","type":"debug","z":"b3c3e994.b8a9b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":510,"y":960,"wires":\[\]},{"id":"1a61ced1.7434b1","type":"delay","z":"b3c3e994.b8a9b8","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":330,"y":1020,"wires":\[\["c59f17fc.7d3be8","9be7ec3e.533a2"\]\]},{"id":"60f85836.2b33f8","type":"ui\_group","name":"TestTime","tab":"a955b030.8e217","order":2,"disp":true,"width":"6","collapse":false},{"id":"a955b030.8e217","type":"ui\_tab","name":"Testing","icon":"mdi:gate","disabled":false,"hidden":false}\]\`
> 
> \### What happens?
> All entities of the form will use values input to pre-fill the values of the form except for the time element. So if you edit any items other than the time field and select submit the time value will become null while all other unmodified items maintain their values. 
> 
> \### What do you expect to happen?
> I expected the time item of the form to react the same as the other items. That way a person could edit z form without always needing to reenter the time entry field.  
> 
> 
> \### Please tell us about your environment:
> \-
> 16 Jul 13:37:30 - \[info\] Node-RED version: v1.3.5
> 16 Jul 13:37:30 - \[info\] Node.js version: v14.17.1
> 16 Jul 13:37:30 - \[info\] Linux 5.10.17-v8 arm64 LE
> 16 Jul 13:37:36 - \[info\] Dashboard version 2.30.0
> 
> \- \[\] Node-RED-Dashboard version: 2.30.0
> \- \[\] Node-RED version: 1.3.5
> \- \[\] node.js version: 14.17.1
> \- \[\] npm version:
> \- \[\] Platform/OS: see above
> Add-on version: 9.2.0
> System: Home Assistant OS 6.1 (aarch64 / raspberrypi4-64)
> Home Assistant Core: 2021.7.1
> Home Assistant Supervisor: 2021.06.8
> \- \[\] Browser: vivaldi (built on chrome) and firefox

Oh, also... (default) label and data format is backwards... but data format probably also depends on region?

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/f/7f8343b6cfee9f984840341a54e6747cc79affab.png)

---

<div class="post-metadata">

**Author:** ![abesis](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@abesis](https://discourse.nodered.org/u/abesis)\
**Post date:** [2 September 2021 08:46 UTC](https://discourse.nodered.org/t/cannot-preload-time-field-in-dashboard-form/50465/3 "2021-09-02T08:46:48Z")

</div>

So, I guess we need to wait for the fix..

> [@Gunner](#):
>
> Oh, also... (default) label and data format is backwards... but data format probably also depends on region?

It does not seem to depend on region. It is `mm/dd/yyyy`. Ι did not find any obvious way to change it.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 September 2021 10:16 UTC](https://discourse.nodered.org/t/cannot-preload-time-field-in-dashboard-form/50465/4 "2021-09-02T10:16:57Z")

</div>

It does depend on language settings I think... mine is  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/d/6d91380f03154dc0fdfa88265b5e806fd3aebdb9.png)  
(the smaller text above is set by the label so is under your control)

I have a fix for the time input in the v3 branch on github. Not quite ready for release.

---

<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:** [2 October 2021 10:17 UTC](https://discourse.nodered.org/t/cannot-preload-time-field-in-dashboard-form/50465/5 "2021-10-02T10:17:37Z")

</div>

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