Not able to prefill Form Node TIME Field

I searched for this topic and found the below thread:

@dceejay mentioned in that thread that some solution will be available in V3.
My node red version is v3.0.0
Do we have some solution for this issue?
my example flow is as below:

[
    {
        "id": "0e8399675eac0a78",
        "type": "inject",
        "z": "557e2ceff4868f83",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"date\":\"2022-07-29\",\"time\":\"22:15\"}",
        "payloadType": "json",
        "x": 550,
        "y": 1640,
        "wires": [
            [
                "e42debc79e43f9fe"
            ]
        ]
    },
    {
        "id": "e42debc79e43f9fe",
        "type": "ui_form",
        "z": "557e2ceff4868f83",
        "name": "date_time_test",
        "label": "table",
        "group": "80c78b5e6273ec34",
        "order": 4,
        "width": 17,
        "height": 1,
        "options": [
            {
                "label": "date",
                "value": "date",
                "type": "date",
                "required": true,
                "rows": null
            },
            {
                "label": "time",
                "value": "time",
                "type": "time",
                "required": true,
                "rows": null
            }
        ],
        "formValue": {
            "date": "",
            "time": ""
        },
        "payload": "",
        "submit": "SAVE",
        "cancel": "CANCEL",
        "topic": "topic",
        "topicType": "msg",
        "splitLayout": true,
        "className": "",
        "x": 800,
        "y": 1640,
        "wires": [
            []
        ]
    },
    {
        "id": "80c78b5e6273ec34",
        "type": "ui_group",
        "name": "test",
        "tab": "b7e619d0975936a4",
        "order": 4,
        "disp": true,
        "width": "17",
        "collapse": false,
        "className": ""
    },
    {
        "id": "b7e619d0975936a4",
        "type": "ui_tab",
        "name": "batch_entry",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

and on dashboard form, I find that date field is prefilled correctly but time field is Empty.

Please advise how to solve this.

Thanks.

It is my understanding that the date and time fields can take a ISO timestamp or a js timestamp, or part of.
e.g.

[{"id":"0e8399675eac0a78","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"date\":\"2022-07-29\",\"time\":6600000}","payloadType":"json","x":190,"y":1820,"wires":[["e42debc79e43f9fe"]]},{"id":"e42debc79e43f9fe","type":"ui_form","z":"30af2d3e.d94ea2","name":"date_time_test","label":"table","group":"80c78b5e6273ec34","order":4,"width":17,"height":1,"options":[{"label":"date","value":"date","type":"date","required":true,"rows":null},{"label":"time","value":"time","type":"time","required":true,"rows":null}],"formValue":{"date":"","time":""},"payload":"","submit":"SAVE","cancel":"CANCEL","topic":"topic","topicType":"msg","splitLayout":true,"className":"","x":440,"y":1820,"wires":[["452090bc.b5229"]]},{"id":"5033290f.4fdcb8","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"date\":\"2022-07-29T00:00:00.000Z\",\"time\":\"1970-01-01T01:50:00.000Z\"}","payloadType":"json","x":160,"y":1880,"wires":[["e42debc79e43f9fe"]]},{"id":"3219fff3.989858","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"date\":1659117548752,\"time\":1659117548752}","payloadType":"json","x":159.3333282470703,"y":1925.3333740234375,"wires":[["e42debc79e43f9fe"]]},{"id":"452090bc.b5229","type":"debug","z":"30af2d3e.d94ea2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":700,"y":1820,"wires":[]},{"id":"80c78b5e6273ec34","type":"ui_group","name":"test","tab":"b7e619d0975936a4","order":4,"disp":true,"width":"17","collapse":false,"className":""},{"id":"b7e619d0975936a4","type":"ui_tab","name":"batch_entry","icon":"dashboard","order":1,"disabled":false,"hidden":false}]
{"date":"2022-07-29T00:00:00.000Z","time":"1970-01-01T01:50:00.000Z"}
or 
{"date":1659117548752,"time":6600000}
or
{"date":"2022-07-29","time":6600000}
1 Like

Yes, It Is an old unresolved issue.

I have found a workaround here Ui_text-input time picker not showing time in dashboard until refreshed - #17 by fmarzocca

One option is to drop the Dashboard time field and use an input field in a template node. Check the code below:

[
    {
        "id": "b65d27e437f51a17",
        "type": "ui_template",
        "z": "0ed2d8ed64bef693",
        "group": "903a6ab8.4f4ca8",
        "name": "time input",
        "order": 1,
        "width": "0",
        "height": "0",
        "format": "<!DOCTYPE html>\n<html>\n<head>\n    <script>\n        var theScope = scope;\n        \n        function updateEntry(){\n            let t_start = document.getElementById(\"editStart\").value;\n            theScope.send({\n                payload:{t_start:t_start}\n                });\n        }\n\n    </script>\n</head>\n\n    <body>\n        <div class=\"container\">\n            <label for=\"editStart\">Start Time:</label>\n            <input type=\"time\" class=\"form-control\" id=\"editStart\" name=\"editStart\" value=\"{{msg.payload.start_time}}\">\n            <button type=\"button\" class=\"btn btn-primary btn-md\" onMouseDown=\"updateEntry()\">Send time to flow</button>\n        </div>\n    </body>\n</html>",
        "storeOutMessages": true,
        "fwdInMessages": false,
        "resendOnRefresh": false,
        "templateScope": "local",
        "className": "",
        "x": 670,
        "y": 740,
        "wires": [
            [
                "70ff830ce29d4d03"
            ]
        ]
    },
    {
        "id": "70ff830ce29d4d03",
        "type": "debug",
        "z": "0ed2d8ed64bef693",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 850,
        "y": 740,
        "wires": []
    },
    {
        "id": "4746976437be4507",
        "type": "function",
        "z": "0ed2d8ed64bef693",
        "name": "",
        "func": "msg.payload = {\n    start_time: \"15:24\",\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 740,
        "wires": [
            [
                "b65d27e437f51a17"
            ]
        ]
    },
    {
        "id": "3fb8e950ac7e27c1",
        "type": "inject",
        "z": "0ed2d8ed64bef693",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 340,
        "y": 740,
        "wires": [
            [
                "4746976437be4507"
            ]
        ]
    },
    {
        "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": 2,
        "disabled": false,
        "hidden": false
    }
]
1 Like

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